common practice for creating utility functions?

John Salerno johnjsal at NOSPAMgmail.com
Mon May 15 16:10:58 EDT 2006


Scott David Daniels wrote:
> John Salerno wrote:
>>> How can I create two separate conditions in a for loop?
>> ... I tried this:
>>
>> punc_space = string.punctuation + string.whitespace
>> for char in punc_space:
> 
> That's probably best.  If the sources are not so simple, you could use:
> 
>     import itertools
> 
>     for char in itertools.chain(onesource, anothersource, yetanother):
>         ...
> 
> --Scott David Daniels
> scott.daniels at acm.org

Cool. Iterators are fun! :)



More information about the Python-list mailing list