On 19 Dec, 10:03, MarkE <[EMAIL PROTECTED]> wrote:
> > No, sets aren't sequences, as they have no order. Same as dicts, which
> > aren't sequences either.
>
> Oops. I was under the misapprehension that they were sequences
I realise now that this is even explicitly documented:
http://docs.python.org/lib/typesseq.html
"There are six sequence types: strings, Unicode strings, lists,
tuples, buffers, and xrange objects."

> Is there a short Pythonic way to determine whether an object is
> iterable (iteratable ??) that I haven't thought of (getattr(obj,
> '__iter__') ?). Would operator.isIterable() be at all a useful
> addition ?
And here I probably meant container (although the url says sequence
when the article meant container, bit like me):
http://docs.python.org/ref/sequence-types.html
"Containers usually are sequences (such as lists or tuples) or
mappings (like dictionaries), but can represent other containers as
well"

So same question, but perhaps "isContainer()" rather than
"isIterable()"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to