Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not sure what you're talking about mate, on Python 3.6:

    >>> "hello world".decode("utf-8")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'str' object has no attribute 'decode'
    >>> b"hello world".encode("utf-8")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'bytes' object has no attribute 'encode'


I'm pretty sure I tripped up on an issue like this on python 3.7 where I double encoded or decoded something. Can't recall the exact case but it was confusing for sure.


That's good. I guess it's only in Python 2 then.


In Python 2 it works almost the same, except you only get an error when encoding/decoding doesn't work out. So I see this as an improvement.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: