The whitespaceless frontend
Edward Elliott
nobody at 127.0.0.1
Tue Apr 25 13:38:54 EDT 2006
bearophileHUGS at lycos.com wrote:
> It's less explicit than self. but it's shorter, this improves typing,
> and allows to produce more compact code:
>
> return "".join(["Graph(", repr($o), ", ", repr($nodeData), ")"])
>
> Instead of:
>
> return "".join(["Graph(", repr(self.o), ", ", repr(self.nodeData),
> ")"])
It also creates a special case. Object attributes are generally accessed as
obj.foo, while $foo only works from within obj. There are more tradeoffs
involved than just compactness and syntax gestalt.
If compactness is all you want, shorten self to s. Personally I like 'me'
as it's both shorter and more vernacular:
def do_GET (me):
me.send_response (200, "ok")
As an added bonus, you get to channel Cookie Monster when you program. :)
c = Cookie ("good enough") # for me
More information about the Python-list
mailing list