fcurella added the comment:
I'm not sure what can be done to make UUIDs work with `hex()`. The only way I
see is to add back something _like_ `__hex__`, but with a different name.
But in that case, I can see how the same arguments that were originally brought
up against `__hex__` could
Change by fcurella :
--
status: -> open
___
Python tracker
<https://bugs.python.org/issue35115>
___
___
Python-bugs-list mailing list
Unsubscrib
fcurella added the comment:
I must admit I was surprised to find out that `hex()` uses `__index__` (which
is supposed to return an integer) and not something like a `__hex__` method
returning the hex.
Maybe we should change the behaviour of `hex()` instead? (in a
backward-compatible way
Change by fcurella :
--
keywords: +patch
pull_requests: +9557
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue35115>
___
___
Python-
New submission from fcurella :
Casting a UUID to an `int` or to a string works as expected:
```
import uuid
value = uuid.UUID()
str(value)
int(value)
```
but casting to an `hex()` raises an exception:
```
import uuid
value = uuid.UUID()
# uuid instances already have the correct value