detecting variable types
Tuure Laurinolli
tuure at laurinolli.net
Wed Sep 22 16:44:07 EDT 2004
Jay wrote:
> def func(**params):
>
> # if params[key1] is a single string
> # do something with params[key1]
>
> # if params[key1] is a list of strings
> for val in params[key1]:
> # do something
>
> Could you suggest a better way to do this without detecting the type?
def func_for_string(astring):
pass
def func_for_a_list_of_strings(alist):
pass
Also, top posting is evil. See
http://www.cs.tut.fi/~jkorpela/usenet/brox.html
More information about the Python-list
mailing list