[Python-Dev] itertools additions: one(), single_valued()

Andreas Klöckner lists at informa.tiker.net
Mon May 26 23:18:21 CEST 2008


On Montag 26 Mai 2008, Boris Borcic wrote:
> > Opinions?
> >
> > Andreas
>
> my_target, = iterable
> my_target, = set(iterable)
>
> quite readably does it, imho, or else one can use
>
> [my_target] = iterable
> [my_target] = set(iterable)
>
> the error messages seem also OK.

True, thanks for pointing this out. :)

I guess the only places where my functions are useful are

a) if you don't want the intermediate result in a variable
or
b) if you can't stomach the storage for the set.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/python-dev/attachments/20080526/ab58abcb/attachment-0001.pgp>


More information about the Python-Dev mailing list