[issue32112] Should uuid.UUID() accept another UUID() instance?
Antti Haapala
report at bugs.python.org
Wed Nov 22 06:12:55 EST 2017
Antti Haapala <antti at haapala.name> added the comment:
I've been hit by this too, in similar contexts, and several times. It is really annoying that it is easier to coerce an UUID or UUID-string to a string than to coerce to a UUID. Usually when the copy semantics are clear and the class is plain old data, Python lets you execute the constructor with an instance of the same class:
>>> bytes(bytes())
b''
>>> bytearray(bytearray())
bytearray(b'')
>>> int(int())
0
>>> complex(complex())
0j
>>> tuple(tuple())
()
I don't to see why this shouldn't be true with UUID as well.
----------
nosy: +ztane
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32112>
_______________________________________
More information about the Python-bugs-list
mailing list