Some Python 2.1 ideas

Moshe Zadka moshez at zadka.site.co.il
Sat Dec 23 23:08:45 EST 2000


On Sat, 23 Dec 2000 09:00:25 -0800, "Bob Alexander" <bobalex at home.com> wrote:

> New operator: embedded assignment

This has already been discussed to death, many times. A PEP would be
useful, if only as a way to put a stop to the discussion <wink>

>     for i in 10:                # equivalent to "for i in xrange(10)"
>     for i in 5:10:             # equivalent to "for i in xrange(5, 10)"
>     for i in 20:10:-1:       # equivalent to "for i in xrange(20, 10, -1)"

This (actually the similar [i:j:k] notation) has been thought over for
2.0 and rejected. You can read the python-dev archives for the discussion.

> Since readline() and its relatives return strings with '\n' attached
> (sometimes), it would be convenient to have a built-in string method that
> removes one if it exists (seems like I'm often coding little functions to do
> this).
> 
>     <string>.chomp()    # sorry, borrowed the method name from Perl

Yep, this actually sounds useful.

-- 
Moshe Zadka <sig at zadka.site.co.il>
This is a signature anti-virus. 
Please stop the spread of signature viruses!




More information about the Python-list mailing list