Iteration of strings
Chad Netzer
cnetzer at mail.arc.nasa.gov
Fri Nov 22 18:47:02 EST 2002
On Friday 22 November 2002 14:58, Bjarke Dahl Ebert wrote:
> When writing small scripts in Python, I often make the same error:
>
> Some function expects a list of strings, and does something like
> for elem in thestringlist: ...
>
> What do you think?
Use an assertion in your function (or script):
def dont_allow_string_argument( s ):
assert not isinstance( s, type("") )
--
Bay Area Python Interest Group - http://www.baypiggies.net/
Chad Netzer
cnetzer at mail.arc.nasa.gov
More information about the Python-list
mailing list