News for hackers. Stuff that matters.
Re:Replacing Python by burntsushi on Sunday September 29, 2013 @11:53AM (#6465470)
I was under the impression that using a class (with `__slots__` set) or a tuple is generally more performant than using dictionaries. At least, I assume that's why he didn't mention dictionaries.
Re:Replacing Python by eevee on Monday September 30, 2013 @08:09PM (#6473179)
The attributes of an object (and its class) are generally stored in a literal dictionary, so it's unlikely that a class will be more performant.

What a class buys you is behavior and a semi-defined interface.

Re:Replacing Python by burntsushi on Monday September 30, 2013 @08:23PM (#6473251)
Uhh... Did you not see my parenthetical reference to `__slots__`? See this SO post[1] for more details.

[1] - http://stackoverflow.com/questions/472000/python-slots

Re:Replacing Python by eevee on Monday September 30, 2013 @10:20PM (#6473649)
Whoops! I could've sworn that said "without", sorry :)

Though I'm not sure `__slots__` actually saves any time, as it's really a space optimization. I've tried it before for hot code and even seen very slight (probably not significant) slowdowns.