>     >>> 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"?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to