invoking multiple methods (Was: Python vs. Ruby)

Mike Meyer mwm at mired.org
Thu Jan 9 10:57:38 EST 2003


Erik Max Francis <max at alcyone.com> writes:

> "Stuart D. Gathman" wrote:
> >   aList.sort();.reverse()       # aList.sort(); aList.reverse()
> > A statement cannot begin with '.', so ';.' means to invoke another
> > method
> > on the same object.
> But is this awkwardness really worth it?  One of Python's truly great
> assets is its transparently readable code.  I'm opposed on general
> principle to anything which defeats that.

True. However, the idea of specifying multiple methods on the same
object is consistent with recent changes (op=, for instance), and
seems useful enough to be worth writing a PEP for - *if* a readable
syntax can be invented for it.

I don't like ;.. I'm not sure I like the idea of tweaking the
semantics of statement at all. Maybe something like:

        aList.(sort(), reverse())

Almost like using a tuple as the method, and it does all the
invocations in the tuple. Except it isn't a real tuple, because the
methods aren't reall calls.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.




More information about the Python-list mailing list