Serhiy Storchaka added the comment:
> - maybe the bug is that python2 should not reject integers, making the
> upgrade path to python3 (or the backward compatibility with python2, same
> thing) easy.
It is too late for this.
You can use the helper that converts the argument to appropriate depending on
the version.
if PY2:
def helper(arg):
if isinstance(ar, (int, long)):
return chr(arg)
return arg
else:
def helper(arg):
return arg
...
v[0] = helper(42)
Or just have different branches for performance critical code:
if PY2:
v[0] = b'\x2a'
else:
v[0] = 42
I don't think Python interpreter should be changed here.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29404>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com