common practice for creating utility functions?

Scott David Daniels scott.daniels at acm.org
Mon May 15 22:00:01 CEST 2006


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



More information about the Python-list mailing list