On Mar 1, 2007, at 12:01 PM, Chris Withers wrote:
Gary Poster wrote:
What should I be using?
Interesting, okay, so how should I work around this bogosity?
Is this a bug?
>>> from BTrees.OOBTree import OOTreeSet,OOSet
>>> for i in OOSet((1,2,3)): print i,
1 2 3
>>> for i in OOTreeSet((1,2,3)): print i,
1 2 3
>>> for i in reversed(OOSet((1,2,3))): print i,
3 2 1
>>> for i in reversed(OOTreeSet((1,2,3))): print i,
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: argument to reversed() must be a sequence
The fact that this works for the OOSet is an implementation accident.
As discussed elsewhere in this thread, sets are not sequences. The
fact that the elements are ordered is an implementation detail
(although given that these sets are essentially the keys of a BTree,
it's unsurprising that they are).
You could argue that reversed(OOSet((1,2,3))) should raise an
exception. IMO, why bother.
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -