New submission from Dominik V. <dominik.vilsmeier1...@gmail.com>:

The paragraph about [How do I convert a string to a 
number?](https://docs.python.org/3/faq/programming.html#how-do-i-convert-a-string-to-a-number)
 contains the following sentence:

> By default, these interpret the number as decimal, so that `int('0144') == 
> 144` and `int('0x144')` raises ValueError.

The first part however doesn't raise an error. Most likely octal notation was 
meant, i.e. `int('0o144') == 144`.

For consistency with the `int('0x144')` part one could also omit the equality 
comparison, i.e. just write `int('0o144')`.

In order to emphasize that the "and" is not part of the code (though this 
should be displayed by the browser) once could also write:

> [...] so that _both_ `int('0o144')` and `int('0x144')` raise ValueError.

(emphasis added)

----------
assignee: docs@python
components: Documentation
messages: 366870
nosy: Dominik V., docs@python
priority: normal
severity: normal
status: open
title: Programming FAQ about "How do I convert a string to a number?" contains 
a typo
type: enhancement
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40340>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to