[issue44866] Inconsistent Behavior of int()

2021-08-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I understand your confusion John. The fact is that int() serves two functions. If argument is a number, it truncates it to an integer. If argument is a string, it parses the string representation of integer (not necessary decimal). For details see https:/

[issue44866] Inconsistent Behavior of int()

2021-08-08 Thread Terry J. Reedy
Terry J. Reedy added the comment: John, for next time, please read https://stackoverflow.com/help/minimal-reproducible-example -- ___ Python tracker ___ _

[issue44866] Inconsistent Behavior of int()

2021-08-08 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pytho

[issue44866] Inconsistent Behavior of int()

2021-08-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: John, there's no need to establish every feature in Python that you are **not** questioning. Please focus on the behaviour that you think is a bug. Pretty much nothing in your example before the line "So everything here is working as expected" is necessary.

[issue44866] Inconsistent Behavior of int()

2021-08-08 Thread Dennis Sweeney
Dennis Sweeney added the comment: You typed `int_y = int(2.8)`, so you passed the floating point number 2.8, which the int() function rounds down to 2. On the other hand when y had the string value '2.8'. The int(y) call tried to parse an integer out of the string, but failed since there wer

[issue44866] Inconsistent Behavior of int()

2021-08-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Following your long example, it seems to me that all works as you expected. Raise an exception if you expect exception, and does raise it if you expect no exception. I may miss something, what exactly does not work as you expected? -- nosy: +serhi

[issue44866] Inconsistent Behavior of int()

2021-08-08 Thread John Joseph Morelli
New submission from John Joseph Morelli : I first noticed this and reported it on the W3 Schools Tutorial, the section entitled "Add Two Numbers with User Input" There were many behaviors that I did not understand, but for this bug report, I will state that the input statements present seem t