Specifing arguments type for a function

Bruno Desthuilliers onurb at xiludom.gro
Fri Jun 23 09:36:42 EDT 2006


George Sakkis wrote:
> Dennis Lee Bieber wrote:
> 
>>On 22 Jun 2006 16:48:47 -0700, "George Sakkis" <george.sakkis at gmail.com>
>>declaimed the following in comp.lang.python:
>>
>>
>>>What does __setitem__ have to do with iterability ?
>>
>>	It confirms that the object is indexable, and mutable -- ie; a list,
>>not a tuple or a string.
> 
> 
> Ok, I'll try once more: What does __setitem__ have to do with
> **iterability**, not mutability or indexability ? 

Nothing.

> I was commenting on
> Maric's post that although some objects are typically iterable, they
> are often treated as atomic by some/many/most applications  (e.g.
> strings). It's not rocket science.

No, it's not rocket science.

It's not rocket science neither to understand that, for the concrete
examples you used (ie strings and tuples), it's quite easy to detect'em
without testing the concrete type.

As you said, what is to be considered as scalar and what's to be
considered as sequence highly depends on the problem at hand. But doing
the distinction does not always implies testing concrete type or mro.

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list