Re: sending string or list to a function

2006-12-05 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Or, just always send the function a list. If you have one string, send > it a list containing that one string. Or, if a single string is more common and the lists are short or generated only for the function call, have the function accept a variable number of arguments:

Re: sending string or list to a function

2006-12-04 Thread [EMAIL PROTECTED]
Or, just always send the function a list. If you have one string, send it a list containing that one string. Cheers, -T -- http://mail.python.org/mailman/listinfo/python-list

Re: sending string or list to a function

2006-12-04 Thread Gabriel Genellina
At Monday 4/12/2006 21:20, 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? That is, rather than having to send a list of one memb

Re: sending string or list to a function

2006-12-04 Thread Farshid Lashkari
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

sending string or list to a function

2006-12-04 Thread manstey
Hi, 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? That is, rather than having to send a list of one member MyFunction(['var1']), I can send MyF