Python 3K or Python 2.9?

TheFlyingDutchman zzbbaadd at aol.com
Wed Sep 12 22:40:04 EDT 2007


>     >>> Foo.bar(foo, "spam")
>     >>> foo.bar("spam")

That looks like a case of "There's more than one way to do it". ;)
The first form is definitely consistent with the
method declaration, so there's a lot to be said for using that style
when teaching people to make classes -> send self, receive self.


> The latter two statements are equivalent. The 'instance.method(args)'
> syntax is just sugar for 'Class.method(instance, args)'.

I think I saw where Guido Van Rossum had referred to something as
"syntactic sugar" in some python.org page. I am not familiar with
sugar as related to syntax. Is it being used as a synonym for "easier
way of doing it"?




More information about the Python-list mailing list