Re: Invalid literal for int() with base 10?

2023-05-25 Thread Chris Angelico
On Fri, 26 May 2023 at 10:26, Kevin M. Wilson via Python-list wrote: > > Ok, I'm not finding any info. on the int() for converting a str to an int > (that specifies a base parameter)?! The picture is of the code I've > written... And the base 10 paradigm involved?? years = int('y') # store for

Re: Invalid literal for int() with base 10?

2023-05-25 Thread MRAB
On 2023-05-25 22:30, Kevin M. Wilson via Python-list wrote: Ok, I'm not finding any info. on the int() for converting a str to an int (that specifies a base parameter)?! The picture is of the code I've written... And the base 10 paradigm involved?? years = int('y') # store for

Re: Invalid literal for int() with base 10?

2023-05-25 Thread Keith Thompson
"Kevin M. Wilson" writes: > Ok, I'm not finding any info. on the int() for converting a str to an > int (that specifies a base parameter)?! https://docs.python.org/3/library/functions.html#int > The picture is of the code I've written... I don't see a picture. The mailing list probably does

Re: From geeksforgeeks.org, on converting the string created by the input() to an INT

2023-05-25 Thread Chris Angelico
On Fri, 26 May 2023 at 09:58, Kevin M. Wilson via Python-list wrote: > > So, why can't a string of an integer be converted to an integer, via > print(int(str('23.5')))??? 23.5 is not an integer, so "23.5" is not the string of an integer. ChrisA --

Re: Invalid literal for int() with base 10?

2023-05-25 Thread Kevin M. Wilson via Python-list
Ok, I'm not finding any info. on the int() for converting a str to an int (that specifies a base parameter)?! The picture is of the code I've written... And the base 10 paradigm involved?? years = int('y') # store for calculation ValueError: invalid literal for int() with base 10: 'y' What is

Re: Invalid literal for int() with base 10?

2023-05-25 Thread Grant Edwards
On 2023-05-25, Kevin M. Wilson via Python-list wrote: > Ok, I'm not finding any info. on the int() for converting a str to > an int (that specifies a base parameter)?! Where are you looking? https://docs.python.org/3/library/functions.html#int > The picture is of the code I've written...

Re: getting rid of the recursion in __getattribute__

2023-05-25 Thread Peter Otten
On 24/05/2023 15:37, A KR wrote: It is perfectly explained in the standards here [1] saying that: In order to avoid infinite recursion in this method, its implementation should always call the base class method with the same name to access any attributes it needs, for example,

Re: [RELEASE] Python 3.12.0 beta 1 released.

2023-05-25 Thread Robin Becker
On 22/05/2023 22:04, Thomas Wouters wrote: > I'm pleased to announce the release of Python 3.12 beta 1 (and feature > freeze for Python 3.12). > ... I see a major difference between 3.12.0a7 and 3.12.0b1 Basically in preppy an importer is defined to handle imports of '.prep' files. This

Re: [RELEASE] Python 3.12.0 beta 1 released.

2023-05-25 Thread Robin Becker
On 25/05/2023 12:23, Robin Becker wrote: On 22/05/2023 22:04, Thomas Wouters wrote: > I'm pleased to announce the release of Python 3.12 beta 1 (and feature > freeze for Python 3.12). > ... I see a major difference between 3.12.0a7 and 3.12.0b1 Basically in preppy an importer is defined

Does os.path relpath produce an incorrect relative path?

2023-05-25 Thread BlindAnagram
I am wondering whether I have misunderstood the semantics of os.path relpath or whether it has a bug. Here is a short test program: --- from os.path import relpath, split src_path = 'C:\\lib\\src\\' vcx_path =

Re: Does os.path relpath produce an incorrect relative path?

2023-05-25 Thread Greg Ewing via Python-list
On 25/05/23 7:49 pm, BlindAnagram wrote: The first of these three results produces an incorrect relative path because relpath does not strip off any non-directory tails before comparing paths. It has no way of knowing whether a pathname component is a directory or not. It's purely an

Re: Does os.path relpath produce an incorrect relative path?

2023-05-25 Thread Eryk Sun
On 5/25/23, BlindAnagram wrote: > > vcx_path = 'C:\\build.vs22\\lib\\lib.vcxproj' > src_path = 'C:\\lib\\src\\' > rel_path = '..\\..\\..\\lib\\src' > > [snip] > > The first of these three results produces an incorrect relative path > because relpath does not strip off any non-directory tails

Re: Does os.path relpath produce an incorrect relative path?

2023-05-25 Thread MRAB
On 2023-05-25 16:53, Eryk Sun wrote: On 5/25/23, BlindAnagram wrote: vcx_path = 'C:\\build.vs22\\lib\\lib.vcxproj' src_path = 'C:\\lib\\src\\' rel_path = '..\\..\\..\\lib\\src' [snip] The first of these three results produces an incorrect relative path because relpath does not strip off any

Invalid literal for int() with base 10?

2023-05-25 Thread Kevin M. Wilson via Python-list
Ok, I'm not finding any info. on the int() for converting a str to an int (that specifies a base parameter)?! The picture is of the code I've written... And the base 10 paradigm involved?? years = int('y') # store for calculationValueError: invalid literal for int() with base 10: 'y'What is

From geeksforgeeks.org, on converting the string created by the input() to an INT

2023-05-25 Thread Kevin M. Wilson via Python-list
We can first convert the string representation of float into float using  float() function and then convert it into an integer using int().So, why can't a string of an integer be converted to an integer, via  print(int(str('23.5')))??? Perplexed | print(int(float('23.5'))) | "When you