flatten tuple

Delaney, Timothy tdelaney at avaya.com
Mon Apr 22 22:29:47 EDT 2002


> From: John Hunter [mailto:jdhunter at nitace.bsd.uchicago.edu]
> 
> >>>>> "Delaney," == Delaney, Timothy <tdelaney at avaya.com> writes:
> 
>     >> I want to be able to create a new tuple, which is the expanded
>     >> and flattened version x, so that if an element of x is a key of
>     >> m, then the new list has that value instead of the key value .
>     >> In the example
> 
>     Delaney> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/121294
>     Delaney> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/118845
> 
> Thanks for the tips -- these look helpful.  
> 
> It appears that I can not use the yield features of generators with
> 2.1.3.  I tried 'from __future__ import generators' but still got a
> Syntax Error on each of the yield lines.  Is this feature only
> supported in the 2.2 line, even with the __future__ ?

That's correct - the other recipe though should help you.

Tim Delaney





More information about the Python-list mailing list