Python 3K or Python 2.9?
bignose+hates-spam at benfinney.id.au
Thu Sep 13 05:57:56 CEST 2007
TheFlyingDutchman <zzbbaadd at aol.com> writes:
(Please, preserve attribution lines so it's clear who wrote what in
your quoted material.)
> > >>> Foo.bar(foo, "spam")
> > >>> foo.bar("spam")
> That looks like a case of "There's more than one way to do it". ;)
Indeed, but there's only one *obvious* way to do it. (The latter, in
> 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.
Sure, go ahead and teach that way if you like; it'll work fine.
> 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"?
Specifically an easier way of doing it provided by the language syntax
(hence "syntactic sugar"). As in, "the form 'foo += 1' is syntactic
sugar for 'foo = foo + 1'".
\ "I don't know half of you half as well as I should like, and I |
`\ like less than half of you half as well as you deserve." -- |
_o__) Bilbo Baggins |
More information about the Python-list