[Python-3000] [Python-Dev] Iterable String Redux (aka StringABC)

Jamie Gennis jgennis at gmail.com
Fri May 30 11:13:08 CEST 2008


Perhaps drawing a distinction between containers (or maybe "collections"?),
and non-container iterables is appropriate?  I would define containers as
objects that can be iterated over multiple times and for which iteration
does not instantiate new objects.  By this definition generators would not
be considered containers (but views would), and for practicality it may be
worth also having an ABC for containers-and-generators (no idea what to name
it).  This would result in the following hierarchy:

iterables
- strings, bytes, etc.
- containers-and-generators
- - containers
- - - tuple, list, set, dict views, etc.
- - generators

I don't think there needs to be different operations defined for the
different ABCs.  They're all just iterables with different iteration
semantics.

Jamie

On Tue, May 27, 2008 at 3:54 PM, Raymond Hettinger <python at rcn.com> wrote:

> "Jim Jewett"
>
>> It isn't really stringiness that matters, it is that you have to
>> terminate even though you still have an iterable container.
>>
>
> Well said.
>
>
>  Guido had at least a start in Searchable, back when ABC
>> were still in the sandbox:
>>
>
> Have to disagree here.  An object cannot know in general
> whether a flattener wants to split it or not.  That is an application
> dependent decision.  A better answer is be able to tell the
> flattener what should be considered atomic in a given circumstance.
>
>
> Raymond
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/jgennis%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-3000/attachments/20080530/1eefcf17/attachment.htm>


More information about the Python-3000 mailing list