Why return None?
Alex Martelli
aleaxit at yahoo.com
Fri Aug 27 06:02:07 EDT 2004
Antoon Pardon <apardon at forel.vub.ac.be> wrote:
...
> Fine practicality beats purity, but then the proponents shouldn't
> put that much weight on consistency, because practicality breaks
> consistency.
No: "but special cases aren't special enough to break the rules". No
rule was broken by introducing += and friends.
> In this case I think the practicality of method chaining beats
> the purity of not allowing side-effects in print statements and
> of having only one obvious way to do things.
You think one way, GvR thinks another, and in Python GvR wins. Go
design your own language where what you think matters.
> I don't see that much difference in the frustration of having
> to write:
>
> t = f(x)
> v[t] = v[t] + 1
You're repeating (necessarily) the indexing operation, which may be
unboundedly costly for a user-coded type.
> and the frustration of having to write
>
> lst = f(x)
> lst.sort()
> lst.reverse()
Here, no operation is needlessly getting repeated.
If you don't see much difference between forcing people to code in a way
that repeats potentially-costly operations, and forcing a style that
doesn't imply such repetitions, I wonder how your language will look.
Still, I'm much happier thinking of you busy designing your own
wonderful language, than wasting your time and yours here, busy
criticizing what you cannot change.
Alex
More information about the Python-list
mailing list