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

Boris Borcic bborcic at gmail.com
Tue May 27 12:13:41 CEST 2008


Andreas Klöckner wrote:
> On Montag 26 Mai 2008, Boris Borcic wrote:
(...)
>>
>> [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

On the near side to ugly, one could attempt the expression equivalents:

(lambda x:x)(*iterable)
(lambda x:x)(*set(iterable))

> or
> b) if you can't stomach the storage for the set.

Yeah, I guess it deserves study.

Cheers, BB



More information about the Python-Dev mailing list