IMO, teoreticaly, instrumentedlist, that is, a relation, is ordered thing, i.e. i could have a.myitems to be order_by something. whether that makes sense or not, and whether u could have two such relations with same contents but in different order - i dont know.
u can convert them to set() and then compare - order will be lost then, explicitly. svil On Tuesday 22 May 2007 11:19:32 Julien Cigar wrote: > Hi list, > > With the following : > >>> a = Invasive.get(67).habitats > >>> b = Invasive.get(57).habitats > >>> type(a), type(b) > > (<class 'sqlalchemy.orm.attributes.InstrumentedList'>, <class > 'sqlalchemy.orm.attributes.InstrumentedList'>) > > >>> a == b > > True > > >>> a > > [<tgias.models.habitat.Habitat object at 0x8d635ec>, > <tgias.models.habitat.Habitat object at 0x8d5d8ec>] > > >>> b > > [<tgias.models.habitat.Habitat object at 0x8d635ec>, > <tgias.models.habitat.Habitat object at 0x8d5d8ec>] > > >>> a.reverse() > >>> a > > [<tgias.models.habitat.Habitat object at 0x8d5d8ec>, > <tgias.models.habitat.Habitat object at 0x8d635ec>] > > >>> b > > [<tgias.models.habitat.Habitat object at 0x8d635ec>, > <tgias.models.habitat.Habitat object at 0x8d5d8ec>] > > >>> a == b > > False > > Would it not be logical to have True instead of False for the last > statement ? Do you think the order of an InstrumentedList is > important for collections (in a boolean context) ? > > thanks > > Regards, > Julien --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
