Chapter 9 Tutorial for Classes Not Working

John Salerno johnjsal at NOSPAMgmail.com
Fri Jun 30 13:39:08 EDT 2006


tac-tics wrote:
>>     x = MyClass
>>     xf = x.f
>>     while True:
>>        print xf()
> 
> Python has some VERY nasty gotchas concerning parenthesis (or lack
> there of).

Is this really a gotcha? I don't think you should blame Python for this 
mistake. Even a novice programmer like myself can intuitively understand 
that parentheses are needed.

And while this *is* something unique to Python (or maybe unique to 
dynamic languages in general?), the actual usage of parentheses is 
consistent with other programming languages, so Python or not, it should 
just make sense to write x = MyClass() instead of x = MyClass



More information about the Python-list mailing list