You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To make the library run under both Python versions with the same code, we need to address the str vs bytes problem.
In Python 2, bytes is an alias for str. In Python 3, bytes is a separate class. These two, despite having the same name, behave completely different: they take different arguments to construct, they return different types when indexed and str and repr don't do the same.
Possible solutions:
Use the bytes class in future.builtins, from pip install future
Use the six bridging library (undesireable, it cannot be exposed to the API user)
The text was updated successfully, but these errors were encountered:
When porting to Python 3 I used bytearray to get numbers when indexing bytes. It's not super clean, but it has the advantage of not cluttering the package with unnecessary dependencies.
Could our Buffer class fill this role? I haven't looked into it much, but it makes sense to use a single type of object for handling binary data across the codebase.
To make the library run under both Python versions with the same code, we need to address the
str
vsbytes
problem.In Python 2,
bytes
is an alias forstr
. In Python 3,bytes
is a separateclass
. These two, despite having the same name, behave completely different: they take different arguments to construct, they return different types when indexed andstr
andrepr
don't do the same.Possible solutions:
bytes
class infuture.builtins
, frompip install future
six
bridging library (undesireable, it cannot be exposed to the API user)The text was updated successfully, but these errors were encountered: