Coding: Fleeting Thoughts

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Yakk
Poster with most posts but no title.
Posts: 11017
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby Yakk » Tue Feb 21, 2017 6:37 pm UTC

Powers of two and am lazy.

17 gives you a carry bit.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
Xanthir
My HERO!!!
Posts: 5081
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Coding: Fleeting Thoughts

Postby Xanthir » Tue Feb 21, 2017 8:44 pm UTC

That's a valid point, sure.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
Xenomortis
Not actually a special flower.
Posts: 1355
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Coding: Fleeting Thoughts

Postby Xenomortis » Fri Mar 17, 2017 12:29 pm UTC

git bisect is awesome.
Tracing an odd performance degradation and I would never have suspect the commit it landed on.
And it's neat way to hammer in the difference between binary and linear searches.
Image

User avatar
The Great Hippo
Posts: 6663
Joined: Fri Dec 14, 2007 4:43 am UTC
Location: behind you

Re: Coding: Fleeting Thoughts

Postby The Great Hippo » Sat Mar 18, 2017 10:05 am UTC

I keep forgetting I can store references to the same set on different objects.

Like, I had a dictionary that mapped values to a set, but I also wanted the set's contents to be accessible by another object -- so I kept trying to think up a scheme to update the object every time this set changed. For some reason, I completely missed that I can just have the object refer to this set, thereby accessing it directly.

(I know that's kind of dangerous because you now have two places where you can modify the set, but in this context, I'm pretty sure it's okay)

User avatar
The Great Hippo
Posts: 6663
Joined: Fri Dec 14, 2007 4:43 am UTC
Location: behind you

Re: Coding: Fleeting Thoughts

Postby The Great Hippo » Sat Mar 18, 2017 11:39 am UTC

Actual coding question:

I'm working with a class that wraps two dictionaries -- one that maps a unique value ("A") to a non-unique value ("b"), and one that maps that non-unique to a set containing all the unique values that are mapped to it. In other words, as one dictionary maps A -> b, another maps b -> {All As mapped to b}.

Does this have a bad smell? I mean, I see a use for it right now -- it solves a major problem and seems really, really useful. But should I be concerned that I'm basically mapping in two directions? Also, is there a name for this sort of mapping? Is it just a normal bijective mapping? It doesn't look like it, since (I think?) bijective mappings must have unique keys and values.

EDIT: Both keys and values are hashable; by 'non-unique', I only mean that A1 -> 5 and A2 -> 5 is valid. Also, maybe this would be describable as an 'invertible' dictionary?

Tub
Posts: 255
Joined: Wed Jul 27, 2011 3:13 pm UTC

Re: Coding: Fleeting Thoughts

Postby Tub » Sat Mar 18, 2017 12:17 pm UTC

The Great Hippo wrote:(I know that's kind of dangerous because you now have two places where you can modify the set, but in this context, I'm pretty sure it's okay)

Either wrap all related sets in another class, which guarantees that additions/deletions are propagated correctly, or (in C++) use a combination of shared_ptr and weak_ptr.

As for your other question, it's not even close to a bijection. It's neither injective nor surjective.

If it's not performance critical, your implementation is ok. It's possible to create a composite data structure that makes updates cheaper and removes redundancy, but it's probably not worth it.

User avatar
WorldTradeRichard
Posts: 18
Joined: Mon Sep 19, 2016 12:33 am UTC

Re: Coding: Fleeting Thoughts

Postby WorldTradeRichard » Sat Mar 18, 2017 1:30 pm UTC

http://mentalfloss.com/article/26316/why-does-my-gadget-say-its-december-31-1969 wrote:Unix is a computer operating system that, in one form or another, is used on most servers, workstations, and mobile devices. It was launched in November 1971 and, after some teething problems, the “epoch date” was set to the beginning of the decade, January 1, 1970. What this means is that time began for Unix at midnight on January 1, 1970 GMT. Time measurement units are counted from the epoch so that the date and time of events can be specified without question. If a time stamp is somehow reset to 0, the clock will display January 1, 1970.


So where does December 31 fit in? It’s because you live in the Western Hemisphere. When it’s midnight in Greenwich, England, it’s still December 31st in America, where users will see December 31, 1969—the day before Unix’s epoch.


I know it's probably been said, in the few years I missed to answer, but that's why it always resets to 1969.
additionally, This question makes me think that all Unix systems, i.e.

(everything)

stops making more dates at that time, probably for memory reasons or something. no clue.

Sorry about the randomness of that.
When I'm Down
And Stressed Out
I just turn it Around
and get Desserts

User avatar
PM 2Ring
Posts: 3599
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Mid north coast, NSW, Australia

Re: Coding: Fleeting Thoughts

Postby PM 2Ring » Sun Mar 19, 2017 3:52 pm UTC

The Great Hippo wrote:Actual coding question:

I'm working with a class that wraps two dictionaries -- one that maps a unique value ("A") to a non-unique value ("b"), and one that maps that non-unique to a set containing all the unique values that are mapped to it. In other words, as one dictionary maps A -> b, another maps b -> {All As mapped to b}.

Does this have a bad smell? I mean, I see a use for it right now -- it solves a major problem and seems really, really useful. But should I be concerned that I'm basically mapping in two directions? Also, is there a name for this sort of mapping? Is it just a normal bijective mapping? It doesn't look like it, since (I think?) bijective mappings must have unique keys and values.

EDIT: Both keys and values are hashable; by 'non-unique', I only mean that A1 -> 5 and A2 -> 5 is valid. Also, maybe this would be describable as an 'invertible' dictionary?


It's a Good Idea to mention which language you're using. IIRC, you use Python. Some languages may have better ways to handle that, but what you're doing is fine in Python. Although I guess you could wrap it in a class to make it cleaner. That way you're bundling the two dicts into one object which can have methods that let you manipulate both dicts in one operation.

User avatar
pogrmman
Posts: 217
Joined: Wed Jun 29, 2016 10:53 pm UTC
Location: Probably outside

Re: Coding: Fleeting Thoughts

Postby pogrmman » Mon Mar 20, 2017 6:11 pm UTC

PM 2Ring wrote:
The Great Hippo wrote:Actual coding question:

I'm working with a class that wraps two dictionaries -- one that maps a unique value ("A") to a non-unique value ("b"), and one that maps that non-unique to a set containing all the unique values that are mapped to it. In other words, as one dictionary maps A -> b, another maps b -> {All As mapped to b}.

Does this have a bad smell? I mean, I see a use for it right now -- it solves a major problem and seems really, really useful. But should I be concerned that I'm basically mapping in two directions? Also, is there a name for this sort of mapping? Is it just a normal bijective mapping? It doesn't look like it, since (I think?) bijective mappings must have unique keys and values.

EDIT: Both keys and values are hashable; by 'non-unique', I only mean that A1 -> 5 and A2 -> 5 is valid. Also, maybe this would be describable as an 'invertible' dictionary?


It's a Good Idea to mention which language you're using. IIRC, you use Python. Some languages may have better ways to handle that, but what you're doing is fine in Python. Although I guess you could wrap it in a class to make it cleaner. That way you're bundling the two dicts into one object which can have methods that let you manipulate both dicts in one operation.


I second building it into a class. It would not be good if you had to remember to modify one after modifying the other. Its best to write methods that do both.

User avatar
The Great Hippo
Posts: 6663
Joined: Fri Dec 14, 2007 4:43 am UTC
Location: behind you

Re: Coding: Fleeting Thoughts

Postby The Great Hippo » Tue Mar 21, 2017 3:01 pm UTC

Thanks! I ended up wrapping two dicts in a class, yeah -- and overloading their __set__ and __del__ built-ins (regrettably, using 'update' -- or other methods like it -- will prolly break the dict, but since this is for my own use, I'm not too concerned).

Semi-related: I've been struggling with the notion of submitting my own PEP for Python; it's probably doomed to failure, but it'd be nice to try something. It's to solve a problem I keep encountering and having to find creative ways to code around. Specifically, it has to do with the variable positional and variable keyword arguments:
Spoiler:

Code: Select all

def foo(*args, **kwargs):
    pass
This function will accept an arbitrary number of positional arguments and keyword arguments. So anything from...

Code: Select all

foo()
...to...

Code: Select all

foo(1, 2, 3)
...to...

Code: Select all

foo(1, 2, 3, keyword="Hello!")
...to...

Code: Select all

foo(keyword="Hello!")
...are all permissible. The positionals are stored in a tuple (in this case, args), and the keywords in a dict (in this case, kwargs). This is super-useful, and I deploy it a lot in my code.

However: Sometimes, I want to use variable keyword arguments with non-variable positional arguments. So I want...

Code: Select all

def foo(a, b, **kwargs):
    pass
...which means I need at least two positionals (in this case, a and b) and an arbitrary number of keywords. Cool! Except what if I want to use 'a' or 'b' as possible keyword arguments? Well...

Code: Select all

foo(1, 2, a=0, b=0)
...is not permissible; it raises a TypeError (because I can't both have 'a' and 'b' as positionals and use them as keyword arguments).

So, I guess the solution is 'use names for your positionals you know you'll never use for keywords' -- but what if I have no idea what keywords I'll be using, yet? When I have a **kwargs, why can't that **kwargs contain labels that are also shared by positionals?

I realize this seems like a pretty slim use-case, but I've seen it come up a couple of times -- particularly where you're trying to use a function or class to produce objects with arbitrary attribute assignments (so you're using **kwargs to basically assign attributes). If you have any positional arguments, whatever name you use for those positional arguments cannot be keywords.


EDIT:
Spoiler:
--and actually, using **kwargs to assign attributes to objects is super-helpful, because **kwargs only accepts string to object assignment -- which means you can't use **kwargs to assign attributes and somehow manage to stash a non-string in the object's __dict__. So you eliminate a whole subclass of possible errors by using **kwargs instead of just passing a dictionary through a function. So yeah, it's a slim use-case, but it's still a pretty useful functionality to have?

User avatar
firechicago
Posts: 619
Joined: Mon Jan 11, 2010 12:27 pm UTC
Location: One time, I put a snowglobe in the microwave and pushed "Hot Dog"

Re: Coding: Fleeting Thoughts

Postby firechicago » Tue Mar 21, 2017 10:41 pm UTC

I understand the problem you're running into, but I'm not sure I understand what you think the actual behavior should be. If you have

Code: Select all

def foo(a, b, **kwargs):
    return a

foo(1, 2, a=0)

what should that last line return? 1? 0? 0.5? choose one at random?

I feel like this is a perfect example of what Douglas Crockford likes to call "foot-guns", i.e. language features that are perfectly calibrated to ruin your day if you don't handle them extra carefully.

Spoiler:
Also, is there a reason you can't just do something like

Code: Select all

def foo(a, b, dict):
and then explicitly reach into the dict when you need to access those variables?

User avatar
The Great Hippo
Posts: 6663
Joined: Fri Dec 14, 2007 4:43 am UTC
Location: behind you

Re: Coding: Fleeting Thoughts

Postby The Great Hippo » Wed Mar 22, 2017 1:34 am UTC

It should return one.

Code: Select all

def foo(**kwargs):
    return a

foo(a=0)
This returns a NameError; the contents of kwargs are not loaded into foo's namespace implicitly. To access them, you must go through kwargs:

Code: Select all

def foo(**kwargs):
    return kwargs["a"]

foo(a=0)
As for why -- **kwargs has some extra benefits in Python 3 (such as preserving order), and by using it, you avoid the risk of accidentally mutating a dictionary (or the pain of having to define a new dictionary every time you just want to call a function).
Last edited by The Great Hippo on Wed Mar 22, 2017 2:38 am UTC, edited 1 time in total.

User avatar
Flumble
Posts: 1693
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: Coding: Fleeting Thoughts

Postby Flumble » Wed Mar 22, 2017 2:34 am UTC

Why does python have this named parameter thing in the first place? The language allows for pretty JSONic notation that only takes a few characters extra. They could've invested time in pattern matching on dicts/named tuples/records rather than supporting this variadic-in-positional-and-named-arguments monstrosity. Even worse, TIL they removed pattern matching power.

User avatar
The Great Hippo
Posts: 6663
Joined: Fri Dec 14, 2007 4:43 am UTC
Location: behind you

Re: Coding: Fleeting Thoughts

Postby The Great Hippo » Wed Mar 22, 2017 2:44 am UTC

Being able to perform easy introspection on functions is super important, though? Especially when you're dealing with stuff like callbacks (where you can store a function with the wrong number of parameters and never find out until it fires much, much later). Pretty sure they got rid of it to expand on inspect.Signature, which -- though a bit bulky and sometimes awkward -- makes function introspection much easier and straightforward.

I don't have a lot of experience with function parameters outside of Python, but -- aside from what I'm talking about now -- I've never encountered any major problems. Python even supports function notation (and through it, I'm pretty sure you can implement pattern checking -- or even type checking, if you'd really like).

User avatar
chridd
Posts: 697
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?
Contact:

Re: Coding: Fleeting Thoughts

Postby chridd » Thu Mar 23, 2017 4:10 am UTC

Possible workaround?

Code: Select all

def foo(*args, **kwargs):
   (a,b) = args
   ...
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics? What phonotactics?) · ze or they · Forum game scores
It's spring; Easter has to be sometime around now, right?
mittfh wrote:I wish this post was very quotable...
flicky1991 wrote:In both cases the quote is "I'm being quoted too much!"

User avatar
The Great Hippo
Posts: 6663
Joined: Fri Dec 14, 2007 4:43 am UTC
Location: behind you

Re: Coding: Fleeting Thoughts

Postby The Great Hippo » Thu Mar 23, 2017 8:14 am UTC

I was about to say that's the workaround I typically use, but I don't like it because it doesn't raise errors when you fail to provide the appropriate number of positionals (less or more than two). But then I realized that since you're unpacking the tuples into two values, it will raise an error -- just not the type of error you'd expect. So, actually, yeah, that's a pretty great workaround, thanks! I'd only make one slight modification:

Code: Select all

def foo(*args, **kwargs):
    try:
        a, b = args
    except ValueError as e:
        raise TypeError(e)
This is just so I get a TypeError, which is what I expect when I feed a function the wrong number of arguments.

(which I realize is... probably some pretty fine hair-splitting on my part. Regardless, yes, that works very well, thank you!)

This even covers the rather narrow use-case of times when I want one of my 'anonymous' positionals to have a default value:

Code: Select all

def foo(*args, **kwargs):
    try:
        a, b = args
    except ValueError:
        try:
           a, b = args[0], None
        except IndexError as e:
            raise TypeError(e)

Maelstrom.
Posts: 76
Joined: Tue Oct 21, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby Maelstrom. » Thu Mar 23, 2017 8:44 am UTC

The Great Hippo wrote:This even covers the rather narrow use-case of times when I want one of my 'anonymous' positionals to have a default value:

Code: Select all

def foo(*args, **kwargs):
    try:
        a, b = args
    except ValueError:
        try:
           a, b = args[0], None
        except IndexError as e:
            raise TypeError(e)


This misbehaves when there are >2 args:

Code: Select all

>>> args = (1, 2, 3)
>>> a, b = args
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack (expected 2)
>>> a, b = args[0], None
>>> a
1
>>> b
None


I would expect this to fail when len(args) > 2

User avatar
Xenomortis
Not actually a special flower.
Posts: 1355
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Coding: Fleeting Thoughts

Postby Xenomortis » Thu Mar 23, 2017 12:29 pm UTC

Code: Select all

// BaseClass x = ... assigned from some where
Object thing;
if (x instanceof ClassA) {
  thing = do_A_things((ClassA) x)
} else if (x instanceof ClassB) {
  thing = do_B_things((ClassB) x)
} else if (x instanceof ClassC) {
...

} else throw Exception();


vs

Code: Select all

Map<Class<?>, Function<Class<?>, Object> functions = new Hashmap....;
functions.put(ClassA.class, y -> do_A_things((ClassA) y);
functions.put(ClassB.class, y -> do_B_things((ClassB) y);
...
Object thing = functions.get(x.getClass()).apply();


The latter is definitely more cool, but is it better? It resembles virtual dispatch quite a bit, but we don't control ClassA/B/C...

User avatar
The Great Hippo
Posts: 6663
Joined: Fri Dec 14, 2007 4:43 am UTC
Location: behind you

Re: Coding: Fleeting Thoughts

Postby The Great Hippo » Thu Mar 23, 2017 5:38 pm UTC

Maelstrom. wrote:I would expect this to fail when len(args) > 2
Oops; pardon, yeah -- I didn't even bother trying to test that code to see if it works.

User avatar
Flumble
Posts: 1693
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: Coding: Fleeting Thoughts

Postby Flumble » Thu Mar 23, 2017 7:40 pm UTC

Xenomortis, can you define some kind of local function do_things :: BaseClass -> Object with overloads for the specific classes? (The program will still call the most specific overload, regardless of whether the object was bound to a variable of a superclass type in between, right?)

User avatar
Xenomortis
Not actually a special flower.
Posts: 1355
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Coding: Fleeting Thoughts

Postby Xenomortis » Thu Mar 23, 2017 10:43 pm UTC

Flumble wrote:Xenomortis, can you define some kind of local function do_things :: BaseClass -> Object with overloads for the specific classes? (The program will still call the most specific overload, regardless of whether the object was bound to a variable of a superclass type in between, right?)


I don't know Java's type rules well enough to answer that.
What I do know is that "Object" is passed around alarmingly liberally in this "greenfield" project.

Edit:
I've gone for the "cool" thing, partly to test my suspicions that certain people aren't actually "reading" the diffs on Github pull requests.
Sometimes, I'm not a nice person.
Image

User avatar
chridd
Posts: 697
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?
Contact:

Re: Coding: Fleeting Thoughts

Postby chridd » Fri Mar 24, 2017 1:11 am UTC

Flumble wrote:Xenomortis, can you define some kind of local function do_things :: BaseClass -> Object with overloads for the specific classes? (The program will still call the most specific overload, regardless of whether the object was bound to a variable of a superclass type in between, right?)
Pretty sure Java overloads are determined at compile time.

Code: Select all

$ cat OverloadTest.java
public class OverloadTest {
   public static void doThing(Object o) {
      System.out.println("doThing(Object)");
   }
   public static void doThing(String s) {
      System.out.println("doThing(String)");
   }
   public static void main(String[] args) {
      Object o = "hello";
      doThing(o);
   }
}
$ java OverloadTest
doThing(Object)
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics? What phonotactics?) · ze or they · Forum game scores
It's spring; Easter has to be sometime around now, right?
mittfh wrote:I wish this post was very quotable...
flicky1991 wrote:In both cases the quote is "I'm being quoted too much!"

User avatar
Sizik
Posts: 1099
Joined: Wed Aug 27, 2008 3:48 am UTC

Re: Coding: Fleeting Thoughts

Postby Sizik » Fri Mar 24, 2017 3:30 pm UTC

chridd wrote:
Flumble wrote:Xenomortis, can you define some kind of local function do_things :: BaseClass -> Object with overloads for the specific classes? (The program will still call the most specific overload, regardless of whether the object was bound to a variable of a superclass type in between, right?)
Pretty sure Java overloads are determined at compile time.

Code: Select all

$ cat OverloadTest.java
public class OverloadTest {
   public static void doThing(Object o) {
      System.out.println("doThing(Object)");
   }
   public static void doThing(String s) {
      System.out.println("doThing(String)");
   }
   public static void main(String[] args) {
      Object o = "hello";
      doThing(o);
   }
}
$ java OverloadTest
doThing(Object)


Otherwise you couldn't do this:

Code: Select all

   public static void main(String[] args) {
      String s = "hello";
      doThing((Object)s); // prints "doThing(Object)"
   }
gmalivuk wrote:
King Author wrote:If space (rather, distance) is an illusion, it'd be possible for one meta-me to experience both body's sensory inputs.
Yes. And if wishes were horses, wishing wells would fill up very quickly with drowned horses.

User avatar
Flumble
Posts: 1693
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: Coding: Fleeting Thoughts

Postby Flumble » Fri Mar 24, 2017 3:33 pm UTC

chridd wrote:
Flumble wrote:Xenomortis, can you define some kind of local function do_things :: BaseClass -> Object with overloads for the specific classes? (The program will still call the most specific overload, regardless of whether the object was bound to a variable of a superclass type in between, right?)
Pretty sure Java overloads are determined at compile time.

Thanks, I had no idea overloading would be done statically.


Sizik wrote:Otherwise you couldn't do this:

Code: Select all

   public static void main(String[] args) {
      String s = "hello";
      doThing((Object)s); // prints "doThing(Object)"
   }

...which is completely reasonable because casting to a superclass to call another overload is stupid. :P

User avatar
Xenomortis
Not actually a special flower.
Posts: 1355
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Coding: Fleeting Thoughts

Postby Xenomortis » Fri Mar 24, 2017 3:42 pm UTC

chridd wrote:
Flumble wrote:Xenomortis, can you define some kind of local function do_things :: BaseClass -> Object with overloads for the specific classes? (The program will still call the most specific overload, regardless of whether the object was bound to a variable of a superclass type in between, right?)
Pretty sure Java overloads are determined at compile time.

Of course they are.
Otherwise we wouldn't need the confusingly named "visitor" pattern (for double-dispatch).
Image

User avatar
phlip
Restorer of Worlds
Posts: 7524
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Coding: Fleeting Thoughts

Postby phlip » Sat Mar 25, 2017 1:47 am UTC

Yeah, as Xenomortis alludes, the magic word here is single dispatch... which method is actually called is based on the actual runtime type of the "this" parameter (ie: calling overridden methods in subclasses) but all of the other parameters are bound statically based off their declared types.

Code: Select all

class Sup {
  public String foo(Sup x) {
    return "Sup.foo(Sup)";
  }
}
class Sub extends Sup {
  public String foo(Sup x) {
    return "Sub.foo(Sup)";
  }
  public String foo(Sub x) {
    return "Sub.foo(Sub)";
  }
}

Sup sup = new Sup();
Sub sub = new Sub();
Sup subAsSup = new Sub();

System.out.println("sup.foo(sup) -> " + sup.foo(sup));
System.out.println("sup.foo(sub) -> " + sup.foo(sub));
System.out.println("sup.foo(subAsSup) -> " + sup.foo(subAsSup));
System.out.println("sub.foo(sup) -> " + sub.foo(sup));
System.out.println("sub.foo(sub) -> " + sub.foo(sub));
System.out.println("sub.foo(subAsSup) -> " + sub.foo(subAsSup));
System.out.println("subAsSup.foo(sup) -> " + subAsSup.foo(sup));
System.out.println("subAsSup.foo(sub) -> " + subAsSup.foo(sub));
System.out.println("subAsSup.foo(subAsSup) -> " + subAsSup.foo(subAsSup));

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
firechicago
Posts: 619
Joined: Mon Jan 11, 2010 12:27 pm UTC
Location: One time, I put a snowglobe in the microwave and pushed "Hot Dog"

Re: Coding: Fleeting Thoughts

Postby firechicago » Sat Mar 25, 2017 4:24 pm UTC

The Great Hippo wrote:It should return one ...the contents of kwargs are not loaded into foo's namespace implicitly.

Oops, getting my Python and Ruby confused. (In Ruby, named parameters are loaded directly into the method's namespace).


Return to “Coding”

Who is online

Users browsing this forum: AdsBot [Google] and 3 guests