> The real
> problem is that iterator is an interface, and there's no formal way to
> express interfaces in Python; it's all in the documentation.
> ...
> The problem with .__getitem__ is, you can't tell whether an object is
> a sequence or a mapping. If it has .__getitem__, it's one or the
> othe
On 11/14/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Having a rich method API vs having a narrow method API and duck-typed support
> functions is a design trade-off. In the case of sequences and mappings, the
> trade-off went towards a richer API because the de facto reference
> implementations w
George Sakkis wrote:
> On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
>> BJ?rn Lindqvist wrote:
>>
>>> But why is both the dict and list protocol so fat then? Is it hard to
>>> create your own dict or list-derived types in Python?
>> don't confuse things like lists and dictionaries with t
On 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> BJ?rn Lindqvist wrote:
>
> > But why is both the dict and list protocol so fat then? Is it hard to
> > create your own dict or list-derived types in Python?
>
> don't confuse things like lists and dictionaries with things like
> sequences and
George Sakkis wrote:
>> don't confuse things like lists and dictionaries with things like
>> sequences and mappings. iterators and iterables belong to the second
>> category.
>
> This doesn't answer my last question: why do we need itertools when we
> can live without sequencetools, mappingtools,