deffunction(input):""" Take an input that may be a iterable or not. """ifisinstance(input,basetring):""" basetring is the only particular case as it is also an iterable"""do_the_stuff(input)else:try:iterable=(xforxininput)exceptTypeError:iterable=(input,)foriiniterable:do_the_stuff(i)
[^] # Re: Le titre est trop long
Posté par GaMa (site web personnel) . En réponse au journal Typage statique versus typage dynamique. Évalué à 0. Dernière modification le 10 juillet 2012 à 13:58.
Matthieu Gautier|irc:starmad