Open amorimlb opened 5 years ago
You are right about this. The problem stems from the fact that untangle
tries to be clever, so you can say object.attribute == "Foo"
.
I will have to think about how to fix this, if it is even possible without major breaking changes.
Ok, thanks for letting me know.
Lucas Amorim
On 18 Nov 2019, at 15:56, Christian Stefanescu notifications@github.com wrote:
You are right about this. The problem stems from the fact that untangle tries to be clever, so you can say object.attribute == "Foo".
I will have to think about how to fix this, if it is even possible without major breaking changes.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stchris/untangle/issues/63?email_source=notifications&email_token=ABMNZRE4UGYXJAVQDAG7MBTQULQNPA5CNFSM4IKNCGUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELQVNQ#issuecomment-555158198, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMNZRFQMCS4BETE7QFY5PDQULQNPANCNFSM4IKNCGUA.
Recently I had to check whether an item in a list of untangle.Element was inside a second list using the
in
operator. Turns out the result was very misleading: Note: I know I shouldn't initialise an untangle.Element object like this (in my real life code I am using untangle.parse('file.xml') which creates a list of various untangle.Element), but this is the smallest syntactically correct code I could supply for this illustration.This prints
True
, but should printFalse
as it does in:So, since the
in
operator uses==
to compare items, I thought it could be a problem with how==
is being implemented in the Element class, which I think I confirmed by running:This prints out
True
, but should printFalse
, as this other code does:Using Python 3.6.8 and untangle 1.1.1 @adijbr contributed to these tests and bug report. Thanks!