[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-25 Thread Kyle Stanley


Change by Kyle Stanley :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-24 Thread Kyle Stanley


Kyle Stanley  added the comment:


New changeset 5aafa548794d23b6d4cafb4fd88289cd0ba2a2a8 by Cajetan Rodrigues in 
branch 'master':
bpo-40340: Separate examples more clearly in the programming FAQ (GH-19688)
https://github.com/python/cpython/commit/5aafa548794d23b6d4cafb4fd88289cd0ba2a2a8


--
nosy: +aeros

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-23 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +19007
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19688

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-23 Thread Cajetan Rodrigues


Cajetan Rodrigues  added the comment:

Yes, I think that's acceptable.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Dominik V.


Dominik V.  added the comment:

Indeed, thanks for clarifying. It seems I misunderstood the example, and 
perhaps that calls for a better separation. What about adding

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

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Cajetan Rodrigues


Cajetan Rodrigues  added the comment:

> these interpret the number as decimal

I'm no linguist, but I feel both expressions in the subordinate clause have 
their purposes, with respect to the the main clause:

* `int('0144') == 144` to show what works
* `int('0x144')` to show what does not work

I don't believe the octal notation was meant in the first example, as the 
equality wouldn't then hold, even if somehow the typecast worked (which it 
doesn't). The point was to positively reinforce the idea that the content of 
the string would be interpreted as a decimal. So something like 
`int('00144') == 144` would still hold True. Negative reinforcement is 
provided in the second example.

But I agree that the sentence itself does not clearly separate the two 
examples, so I would suggest adding a comma after the first example, like so:

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

--
nosy: +cajetan.rodrigues

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Dominik V.


New submission from Dominik V. :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com