Python vs. Ruby
Rob Renaud
rpgnmets at aol.com
Wed Jan 1 17:01:09 EST 2003
<lot snipped>
"John Roth" <johnroth at ameritech.net> wrote in message
> Whether append() returns a *new* object or not is irrelevant to
> my arguement. The fact that it returns None is the wart.
>
> John Roth
It's consistant, not a wart from my perspective. If an object is
modified, it is not returned.
For every part of the (admittedly small) python library I know, that
is the case. Returning None is a hint that the object is modified.
So then the question becomes, why don't append(), sort(), reverse()
return a new list and not modify the original? Are mutable objects
themselves a wart on the langauge?
More information about the Python-list
mailing list