[Python-Dev] Re: Comparing UUID objects to strings: why not?

2020-01-23 Thread Michael Anckaert via Python-Dev
Thank you all for your feedback, you all make very good points. I'll take a deeper look at the resources given. Bernardo Sulzbach writes: > I think that if the other object is a string, trying to get a UUID > from it to compare UUIDs makes more sense than converting the UUID to > string and

[Python-Dev] Comparing UUID objects to strings: why not?

2020-01-23 Thread Michael Anckaert via Python-Dev
Hello everyone I have a usecase where I'm comparing a UUID instance with string quite often. A case where I have to convert the UUID instance to a string using str(uuid_obj), leading to redundant code: if str(uuid_obj) == uuid: # do stuff... In my experience I can't find a case