gh at ghaering.de
Fri Mar 14 00:50:57 CET 2003
Max Khesin wrote:
> Hi all,
> I just started with the snake, coming from a C++ background (and what a cool
> snake it is!).
> Anyway, is method nesting possible in python, e.g.
> even if sort() does not return a reference to self, are there methods that
> do and is it a common Python programming style?
No, list methods (like sort) don't return the original list. It's
common to use a temporary variable for this. If you want to, you can
subclass list so sort returns the changed list, if you *really* want
Wether lists methods should return their changed value has been
discussed at length on this list in the past, so you should be able to
use groups.google.com to review this discussion and the rationale for
the current behaviour.
mail: gh at ghaering.de
More information about the Python-list