Specifing arguments type for a function
george.sakkis at gmail.com
Fri Jun 23 01:48:47 CEST 2006
Bruno Desthuilliers wrote:
> George Sakkis a écrit :
> > This is ok - in theory. In practice I've found that e.g. strings are
> > more often than not handled as scalars although they are typically
> > iterables.
> >>> hasattr('', '__iter__')
>>> hasattr('', '__iter__') or hasattr('', '__getitem__')
> > Also tuples may or may not be considered as iterables,
> > depending on what they are used for.
> >>> hasattr((), '__setitem__')
> >>> hasattr('', '__setitem__')
What does __setitem__ have to do with iterability ?
More information about the Python-list