invoking multiple methods (Was: Python vs. Ruby)

Jack Diederich jack at performancedrivers.com
Thu Jan 9 13:29:07 EST 2003


On Thu, Jan 09, 2003 at 03:57:38PM +0000, Mike Meyer wrote:
> 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())
> 

Some people seem to like lists, etc to return an lvalue and other
people think it dilutes the language.  To borrow from another language
would something like

import lvalues from pragma

be acceptable?
The return values that are currently None would then be self for all
calls in that module.

-jackdied





More information about the Python-list mailing list