Message328929
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 stored in the `.hex` attribute
value.hex
# this raises `TypeError: 'UUID' object cannot be interpreted as an integer`
hex(value)
# this behaves correctly
hex(value.int)
```
Adding support for `hex()` should be simple enough as adding the following to the UUID class in https://github.com/python/cpython/blob/54752533b2ed1c898ffe5ec2e795c6910ee46a39/Lib/uuid.py#L69:
```
def __index__(self):
return self.int
``` |
|
Date |
User |
Action |
Args |
2018-10-30 15:12:16 | fcurella | set | recipients:
+ fcurella |
2018-10-30 15:12:16 | fcurella | set | messageid: <1540912336.8.0.788709270274.issue35115@psf.upfronthosting.co.za> |
2018-10-30 15:12:16 | fcurella | link | issue35115 messages |
2018-10-30 15:12:16 | fcurella | create | |
|