Not sure if this is a bug or intended behavior, but
does not raise any warnings. In Python 2, bytes is treated as str. On one hand, it makes sense that no warning is issued as str([1, 2]) is still valid code and will compile. But from a logical perspective, the code is inherently different. Python 3 will return b"\x01\x02" whereas Python 2 produces "[1, 2]".
Not sure if this is a bug or intended behavior, but
does not raise any warnings. In Python 2,
bytesis treated asstr. On one hand, it makes sense that no warning is issued asstr([1, 2])is still valid code and will compile. But from a logical perspective, the code is inherently different. Python 3 will returnb"\x01\x02"whereas Python 2 produces"[1, 2]".