[issue44018] Bug in random.seed
Eugene Rossokha
report at bugs.python.org
Mon May 3 06:00:53 EDT 2021
Eugene Rossokha <arjaz at protonmail.com> added the comment:
I find the following behaviour very confusing:
>>> import random
>>> a = bytearray("1234", "utf-8")
>>> b = bytearray("1234", "utf-8")
>>> a == b
True
>>> random.seed(a)
>>> a == b
False
>>> a
bytearray(b'1234\xd4\x04U\x9f`.\xabo\xd6\x02\xacv\x80\xda\xcb\xfa\xad\xd1603^\x95\x1f\tz\xf3\x90\x0e\x9d\xe1v\xb6\xdb(Q/.\x00\x0b\x9d\x04\xfb\xa5\x13>\x8b\x1cn\x8d\xf5\x9d\xb3\xa8\xab\x9d`\xbeK\x97\xcc\x9e\x81\xdb')
>>> b
bytearray(b'1234')
The function doesn't document it will change the input argument
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44018>
_______________________________________
More information about the Python-bugs-list
mailing list