In python 3.2, i can change the type of an object easily. For example :
x=0 print(type (x)) x=bytes(0) print(type (x))
it will give me this
In Python 2.x, bytes is just an alias for str, so everything works as expected. Moreover, you are not changing the type of any objects here – you are merely rebinding the name x to a different object.
bytes
str
x