Re: Function returns old value

2020-12-16 Thread dn via Python-list
On 17/12/2020 16:06, Bischoop wrote: On 2020-12-17, dn wrote: Remember that posts to the list are archived, and thus may be searched. People experiencing similar problems in-future will be able to 'mine' the archives for help and advice. Using a/any pastebin is great for immediate sharing. Re

Re: Review, suggestion etc?

2020-12-16 Thread Bischoop
On 2020-12-17, Bischoop wrote: Accidently removed the paste, https://bpa.st/E3FQ -- https://mail.python.org/mailman/listinfo/python-list

Re: Function returns old value

2020-12-16 Thread Bischoop
On 2020-12-17, dn wrote: > Remember that posts to the list are archived, and thus may be searched. > People experiencing similar problems in-future will be able to 'mine' > the archives for help and advice. > > Using a/any pastebin is great for immediate sharing. Remember that in > this case t

Re: Function returns old value

2020-12-16 Thread dn via Python-list
On 17/12/2020 15:40, Bischoop wrote: On 2020-12-12, Terry Reedy wrote: Don't post links to unknown sites. Reduce it to the minimum needed to exhibit the questionable behavior and include inline with the question. BTW bpa.st/+python is well known for code sharing among Python communities it

Re: Function returns old value

2020-12-16 Thread Bischoop
On 2020-12-12, Terry Reedy wrote: > > Don't post links to unknown sites. Reduce it to the minimum needed to > exhibit the questionable behavior and include inline with the question. > >> How this functions should look properly? > > I've solved the problem. BTW bpa.st/+python is well known for c

Review, suggestion etc?

2020-12-16 Thread Bischoop
I've done my biggest project that allowed me to learn a lot. It's basically simply Database with basic options >> https://bpa.st/FU4A . What sucks here is basically the find_people() I'll have to work on it yet to make it more useful. . If anyone was bored and wished to point me some wrong way or

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Cameron Simpson
On 16Dec2020 21:59, Chris Green wrote: >Cameron Simpson wrote: >> On 16Dec2020 18:51, Chris Green wrote: >> >The specific problem that finally prevented me from managing to get it >> >to work was a (Linux) .so file that had been built for Python 2 and, >> >as I don't have the source, I can't bui

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Chris Angelico
On Thu, Dec 17, 2020 at 9:06 AM Chris Green wrote: > > Also, make note of the specific Python 2 version where your software > > works - the CPython API does change somewhat sometimes. > > > I still have python 2. The issue is that the programs need modules > which come from a PPA to support Pytho

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Chris Green
Cameron Simpson wrote: > On 16Dec2020 18:51, Chris Green wrote: > >The specific problem that finally prevented me from managing to get it > >to work was a (Linux) .so file that had been built for Python 2 and, > >as I don't have the source, I can't build for Python 3. > > ChrisA I think suggeste

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Chris Angelico
On Thu, Dec 17, 2020 at 8:26 AM Cameron Simpson wrote: > > On 16Dec2020 18:51, Chris Green wrote: > >The specific problem that finally prevented me from managing to get it > >to work was a (Linux) .so file that had been built for Python 2 and, > >as I don't have the source, I can't build for Pyth

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Cameron Simpson
On 16Dec2020 18:51, Chris Green wrote: >The specific problem that finally prevented me from managing to get it >to work was a (Linux) .so file that had been built for Python 2 and, >as I don't have the source, I can't build for Python 3. ChrisA I think suggested keeping a Python 2.7 install aroun

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Chris Angelico
On Thu, Dec 17, 2020 at 7:27 AM MRAB wrote: > > On 2020-12-16 19:16, Chris Angelico wrote: > > On Thu, Dec 17, 2020 at 6:06 AM Chris Green wrote: > >> > >> Some time ago (in July) I asked some questions here > >> about problems migrating some code from Python 2 to Python 3. > >> > >> The specific

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread MRAB
On 2020-12-16 19:16, Chris Angelico wrote: On Thu, Dec 17, 2020 at 6:06 AM Chris Green wrote: Some time ago (in July) I asked some questions here about problems migrating some code from Python 2 to Python 3. The specific problem that finally prevented me from managing to get it to work was a

Re: Fwd: bug in download

2020-12-16 Thread Terry Reedy
On 12/16/2020 12:15 PM, Erick Willum wrote: Begin forwarded message: From: Erick Willum Date: 16 December 2020 at 15:53:40 GMT To: python-list@python.org Subject: bug in download Hallo and good afternoon, Having installed python (big thank you) and sublime text, i get the next message wh

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Grant Edwards
On 2020-12-16, Dennis Lee Bieber wrote: > On Tue, 15 Dec 2020 20:08:53 + (UTC), Mark Polesky via Python-list > declaimed the following: > >>behavior, and I can't remember any programming language in which it's >>different. > > https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_name Mo

Re: Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Chris Angelico
On Thu, Dec 17, 2020 at 6:06 AM Chris Green wrote: > > Some time ago (in July) I asked some questions here > about problems migrating some code from Python 2 to Python 3. > > The specific problem that finally prevented me from managing to get it > to work was a (Linux) .so file that had been built

Python 2 to Python 3 .so library incompatibility - need help

2020-12-16 Thread Chris Green
Some time ago (in July) I asked some questions here about problems migrating some code from Python 2 to Python 3. The specific problem that finally prevented me from managing to get it to work was a (Linux) .so file that had been built for Python 2 and, as I don't have the source, I can't build

Fwd: bug in download

2020-12-16 Thread Erick Willum
Begin forwarded message: > From: Erick Willum > Date: 16 December 2020 at 15:53:40 GMT > To: python-list@python.org > Subject: bug in download > > Hallo and good afternoon, > > Having installed python (big thank you) and sublime text, i get the next > message when trying to download numpy

Re: Python concurrent.futures.ProcessPoolExecutor

2020-12-16 Thread MRAB
On 2020-12-16 16:04, Rob Rosengard wrote: Warning: I am new to this group Warning: I am not an expert at Python, I've written a few small programs, and spend 20 hours of online classes, and maybe a book or two. Warning: I am new to trying to use concurrent.futures.ProcessPoolExecutor - Prior

Re: Python concurrent.futures.ProcessPoolExecutor

2020-12-16 Thread Dan Stromberg
On Wed, Dec 16, 2020 at 9:23 AM Israel Brewster wrote: > > On Dec 16, 2020, at 7:04 AM, Rob Rosengard > wrote: > > > > Warning: I am new to this group > > Warning: I am not an expert at Python, I've written a few small > programs, and spend 20 hours of online classes, and maybe a book or two.

Re: Python concurrent.futures.ProcessPoolExecutor

2020-12-16 Thread Israel Brewster
> On Dec 16, 2020, at 7:04 AM, Rob Rosengard wrote: > > Warning: I am new to this group > Warning: I am not an expert at Python, I've written a few small programs, > and spend 20 hours of online classes, and maybe a book or two. > Warning: I am new to trying to use concurrent.futures.Process

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Ethan Furman
On 12/16/20 3:08 AM, Peter J. Holzer wrote: On 2020-12-15 13:07:25 -0800, Ethan Furman wrote: On 12/15/20 9:07 AM, Mark Polesky via Python-list wrote: D = {'a':1} def get_default(): print('Nobody expects this') return 0 print(D.get('a', get_default())) Python has short-circuiti

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Ethan Furman
On 12/16/20 1:44 AM, Chris Angelico wrote: On Wed, Dec 16, 2020 at 8:43 PM Loris Bennett wrote: Paul Bryan writes: On Wed, 2020-12-16 at 10:01 +0100, Loris Bennett wrote: OK, I get the point about when the default value is generated and that potentially being surprising, but in the exampl

Python concurrent.futures.ProcessPoolExecutor

2020-12-16 Thread Rob Rosengard
Warning: I am new to this group Warning: I am not an expert at Python, I've written a few small programs, and spend 20 hours of online classes, and maybe a book or two. Warning: I am new to trying to use concurrent.futures.ProcessPoolExecutor - Prior to writing this question I updated to Pytho

Re: Python3 change logs

2020-12-16 Thread Rich Shepard
On Tue, 15 Dec 2020, Terry Reedy wrote: In particular, for latest release (now 3.9) you would want tkinter in https://docs.python.org/3/whatsnew/3.9.html#improved-modules but nothing there. However, https://docs.python.org/3.8/whatsnew/3.8.html#tkinter Thanks, Terry. Stay well, Rich -- https

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Chris Angelico
On Wed, Dec 16, 2020 at 10:17 PM Peter J. Holzer wrote: > > On 2020-12-15 13:07:25 -0800, Ethan Furman wrote: > > On 12/15/20 9:07 AM, Mark Polesky via Python-list wrote: > > > > > D = {'a':1} > > > > > > def get_default(): > > > print('Nobody expects this') > > > return 0 > > > > > > pr

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Peter J. Holzer
On 2020-12-15 13:07:25 -0800, Ethan Furman wrote: > On 12/15/20 9:07 AM, Mark Polesky via Python-list wrote: > > > D = {'a':1} > > > > def get_default(): > > print('Nobody expects this') > > return 0 > > > > print(D.get('a', get_default())) > > Python has short-circuiting logical operat

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Loris Bennett
Paul Bryan writes: > Maybe this will help: > def get(key, default): > ... print("entering get") > ... print(f"{key=} {default=}") > ... print("exiting get") > ... def generate_default(): > ... print("entering generate_default") > ... print("exiting generate_default") > ...

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Chris Angelico
On Wed, Dec 16, 2020 at 8:43 PM Loris Bennett wrote: > > Paul Bryan writes: > > > On Wed, 2020-12-16 at 10:01 +0100, Loris Bennett wrote: > > > >> OK, I get the point about when the default value is generated and > >> that > >> potentially being surprising, but in the example originally given, >

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Loris Bennett
Paul Bryan writes: > On Wed, 2020-12-16 at 10:01 +0100, Loris Bennett wrote: > >> OK, I get the point about when the default value is generated and >> that >> potentially being surprising, but in the example originally given, >> the >> key 'a' exists and has a value of '1', so the default value i

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Paul Bryan
Maybe this will help: >>> def get(key, default): ... print("entering get") ... print(f"{key=} {default=}") ... print("exiting get") ... >>> def generate_default(): ... print("entering generate_default") ... print("exiting generate_default") ... return 1 ... >>> get("a", generate_defa

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Paul Bryan
On Wed, 2020-12-16 at 10:01 +0100, Loris Bennett wrote: > OK, I get the point about when the default value is generated and > that > potentially being surprising, but in the example originally given, > the > key 'a' exists and has a value of '1', so the default value is not > needed. But the func

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Loris Bennett
Paul Bryan writes: > On Wed, 2020-12-16 at 08:59 +0100, Loris Bennett wrote: > >> Isn't the second argument to D.get() the value to be return if the >> first >> argument is not a valid key?  In that case, why does it make any >> difference here what the second argument of D.get() is since the key

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Paul Bryan
On Wed, 2020-12-16 at 08:59 +0100, Loris Bennett wrote: > Isn't the second argument to D.get() the value to be return if the > first > argument is not a valid key?  In that case, why does it make any > difference here what the second argument of D.get() is since the key > 'a' > does exist? > > Th

Re: dict.get(key, default) evaluates default even if key exists

2020-12-16 Thread Loris Bennett
Serhiy Storchaka writes: > 15.12.20 19:07, Mark Polesky via Python-list пише: >> # Running this script >> >> D = {'a':1} >> def get_default(): >>     print('Nobody expects this') >>     return 0 >> print(D.get('a', get_default())) >> >> # ...generates this output: >> >> Nobody expects this