On 19 Dec, 05:24, Gabriel Genellina [EMAIL PROTECTED] wrote:
En Tue, 18 Dec 2007 09:15:12 -0300, English, Mark [EMAIL PROTECTED]
escribió:
try: set
except NameError: from sets import Set as set
class myset_fails(set): pass
class myset_works(set):
def __getitem__(self): pass
s
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:
En Wed, 19 Dec 2007 06:28:03 -0300, MarkE [EMAIL PROTECTED]
escribi�:
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 ?
Yes, I think the
MarkE [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
|| Is there a short Pythonic way to determine whether an object is
| iterable (iteratable ??)
Welcome to Python and its neat concept of iterables and iterators.
An iterable is an object that has an __iter__ method that returns an
X-Replace-Address:
[EMAIL PROTECTED]
receding_xxxs_.com
This wasn't what I was expecting, so I thought I'd ask those more
knowledgeable, which is pretty much everybody.
Same result on Python 2.3.5 and Python 2.5.1 installed from python.org
binaries on Windows XP.
try: set
except NameError:
En Tue, 18 Dec 2007 09:15:12 -0300, English, Mark [EMAIL PROTECTED]
escribió:
try: set
except NameError: from sets import Set as set
class myset_fails(set): pass
class myset_works(set):
def __getitem__(self): pass
s = set()
fails = myset_fails()
works = myset_works()
import