[David Mertz <me...@gnosis.cx>]
> ...
> What we get instead is a clear divide between mutating methods
> on collections that (almost)  always return None, and functions
> like sorted() and reversed() that return copies of the underlying
> collection/iterable. Of course, there are many methods that don't
> have functions matching them. Python could have been designed
> differently, but using the consistency it follows is best.

For a bit of history that I may have made up (heh - memory fades over
time!), as I recall, the very first Python pre-releases echoed to
stdout every non-None statement result.  So, e.g.,

    for i in range(5):
        i

displayed the same as the current

    for i in range(5):
        print(i)

But one prolific early user loved chaining mutating method calls, each
returning `self`, and so their output was littered with crap they
didn't want to see.  They didn't want to prefix every computational
statement with, e.g., "ignore = ", so Guido stopped the magical
output.

Perhaps surprisingly, few people noticed the difference.  But that may
in large part be due to that there were few people, period.

Or I'm just hallucinating again :-)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WOKUBTEZEXCX5HE4TKJ5GG73ILVO6LMK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to