Puzzled by list-appending behavior
Ben Finney
ben+python at benfinney.id.au
Thu May 26 01:11:56 EDT 2011
Uncle Ben <bgreen at nycap.rr.com> writes:
> Can someone explain this to me?
Yes, the documentation for that function (‘list.append’) can explain it.
In short: if a method modifies the instance, that method does not return
the instance. This policy holds for the built-in types, and should be
followed for user-defined types also.
--
\ “[I]t is impossible for anyone to begin to learn that which he |
`\ thinks he already knows.” —Epictetus, _Discourses_ |
_o__) |
Ben Finney
More information about the Python-list
mailing list