enhancing 'list'

samwyse samwyse at gmail.com
Mon Jan 18 13:49:06 CET 2010


On Jan 18, 6:20 am, Peter Otten <__pete... at web.de> wrote:
> Note that the cmp() builtin and the cmp parameter for list.sort() are gone
> in Python 3.

I've got Python 3 installed, and am using it for most new
development.  In this case case, however, I'm writing for the Google
App Engine, which is stuck at 2.5.  :(  (Curiously, no matter how I
order my PATH, the wrong version seems to appear first more than half
the time!  I'm seriously considering renaming all my Python 3 code to
use a .py3 file extension.)

> samwyse wrote:
> > As a side note, wouldn't it be nice if '...' could be used in more
> > places than just slices?  IMHO, a useful idiom would be to use it to
> > signify "irrelevant" or "don't care", as opposed to 'None' which (in
> > my mind, at least) signifies "missing" or "unknown".
>
> That is a pretty subtle distinction...

Hey, I'm a pretty subtle person...

> I prefer keyword arguments, but in Python 3 you can use the ellipsis literal
> freely:
>
> >>> ... == ...
> True
> >>> [..., 42, ...].count(...)
>
> 2
>
> Peter

I must have either missed or forgotten about that.  Thanks!



More information about the Python-list mailing list