Why return None?

Alex Martelli aleaxit at yahoo.com
Thu Aug 26 15:40:37 CEST 2004

Martin DeMello <martindemello at yahoo.com> wrote:

> Alex Martelli <aleaxit at yahoo.com> wrote:
> > Not leaving stylistic choice (which would lead to more than one obvious
> > way to do it) is quite consonant with the Zen of Python.  Of course one
> > can't always reach what's preferable, but "your main point" which is
> > presumably meant as a criticism of this design choice comes across as
> > praise: the design choice follows the overall design's philosophy.
> I still feel the the One Obvious Way should have been to return self...

When you design your own language, you get to impose in it what's
obvious to _you_ -- or go the Perl way and try to squeeze in as many
different ways to do every single task as possible so everybody's happy
except those who can't stand bloated languages (who'll stick with

> > Guido doesn't like method chaining, so he made a design choice that did
> > not allow method chaining, and did not give several equally obvious ways
> But that's pretty hard to argue with :)

Indeed, it's not meant to be arguable-with;-).  Personally I like method
chaining, but it's clearly not the Python way, and I appreciate
consistency and simplicity more than I appreciate picking and choosing
details of my preferred style.


More information about the Python-list mailing list