On Tue, Oct 25, 2016 at 6:20 AM, Michel Desmoulin
<desmoulinmic...@gmail.com> wrote:
> Some things deserve a big explanation to solve the problem. It would be nice
> to add a link to official tutorial in the documentation.
>
> E.G, encoding is a big one:
>
>    In [8]: b'é' + 'é'
>      File "<ipython-input-8-cfac1add5f26>", line 1
>        b'é' + 'é'
>               ^
>    SyntaxError: bytes can only contain ASCII literal characters.
>
> This is not helpful to somebody unaware of the difference between text and
> bytes.
>
> Possible solution:
>
>    In [8]: b'é' + 'é'
>      File "<ipython-input-8-cfac1add5f26>", line 1
>        b'é' + 'é'
>               ^
>    SyntaxError: You cannnot concatenate bytes (b'é...') with
>    a string ('é...'). Learn more about fixing this error at
> https://doc.python.org/errors/7897978

I don't disagree with the principle, but I don't see how this
particular example works. The interpreter here doesn't know that
you're trying concatenate a bytes and a string, because the error
happens before that, when it tries to make the bytes object. These
really are two different errors.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to