manstey wrote:
> Is there a neat way to write a function that can receive either a
> string or a list of strings, and then if it receives a string it
> manipulates that, otherwise it manipulates each string in the list?

The following code shows one way you can accomplish this. I don't 
consider it bad programming style to allow your functions to accept 
multiple data types.

def MyFunction(val):
     if isinstance(val,basestring):
         val = [val]
     for s in val:
         #Process string


-Farshid
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to