On Sun, Nov 10, 2013 at 10:39 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Sun, Nov 10, 2013 at 2:22 AM, Chris Angelico <ros...@gmail.com> wrote: >> JavaScript has magic around the dot and function-call operators, as I >> mentioned earlier. Lots of other languages have some little quirk >> somewhere that breaks this rule; some have a LOT of quirks that break >> this rule. Does Python have any? Aside from parsing oddities like >> attribute access on a literal integer[1], are there any cases where >> two expressions yielding the same object are in any way different? > > I can think of one: > > class Spam: > def __init__(self): > super().__init__() # This works. > > sup = super > > class Eggs: > def __init__(self): > sup().__init__() # This doesn't.
Ah, yes, super() is magical. In that particular instance, I think the magic is better than the alternative, but let's face it: Multiple inheritance is an inherently hard problem, so a solution that has so little magic and manages to achieve the goal is doing well. The only thing that would have been better than this would be making it a piece of special syntax rather than something that looks like a function call, but it's too late to change now. ChrisA -- https://mail.python.org/mailman/listinfo/python-list