Message366870
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) |
|
Date |
User |
Action |
Args |
2020-04-20 19:37:45 | Dominik V. | set | recipients:
+ Dominik V., docs@python |
2020-04-20 19:37:45 | Dominik V. | set | messageid: <1587411465.5.0.0585658579804.issue40340@roundup.psfhosted.org> |
2020-04-20 19:37:45 | Dominik V. | link | issue40340 messages |
2020-04-20 19:37:45 | Dominik V. | create | |
|