Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
You left out 3CPO, Dave. Names with numerals are not unreasonable in some circumstances. But programming languages are not a full spectrum of real life. They can have  reserved words too so you may not be able to use "while" and if you choose to create a function that masks another, you cannot

Re: EAFP

2022-05-13 Thread dn
On 14/05/2022 04.37, bryangan41 wrote: > Is the following LBYL:foo = 123if foo < 200:    do() Yes (once formatted for Python). If so, how to change to EAFP? Not sure if can. Let's alter the code to: foo = 0 #and def do(): return 5 / foo Then, you will expect a ZeroDivisionError

Re: .0 in name

2022-05-13 Thread dn
This is not what @Avi menat by "silly variable names" but: 3D_position 2nd_floor_area 3M_PostIt_size 3rd_degree_polynomial 360_degree_view 12_hours_later and ??? 2_fast_2_furious -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Seeking deeper understanding of python equality (==)

2022-05-13 Thread Jonathan Kaczynski
Thank you for your responses, Sam and Greg. The do_richcompare function is where my research originally took me, but I feel like I'm still missing some pieces to the puzzle. Here is my updated research since you posted your responses (I'll attach a pdf copy too):

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
Boy do I hate when I see my code mangled by the stupid AOL mailer. Not that anyone cares, but the code should be read with each line starting with the "> " prompt. If I leave lots of blank lines, it may work, but as the illustration is not in python, I will now remove the prompts: `5x^2 +

Re: .0 in name

2022-05-13 Thread Paul Bryan
On Fri, 2022-05-13 at 22:02 +, Avi Gross via Python-list wrote: > So why you wonder where it is documented that variables cannot be > what you feel like is a bit puzzling!  I had just assumed on good faith that the request to the documentation would be so that the OP could determine what is

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
Bryan, As has been pointed out, it is very common in possibly all programming languages to not allow digits at the start of many identifiers. It makes it hard to parse for numbers which tend to start with digits. Some languages even have special rules on not starting a number with a zero unless

Re: .0 in name

2022-05-13 Thread Paul Bryan
On Sat, 2022-05-14 at 00:47 +0800, bryangan41 wrote: > May I know (1) why can the name start with a number? The name of an attribute must be an identifier. An identifier cannot begin with a decimal number. > (2) where in the doc is it?!

EAFP

2022-05-13 Thread bryangan41
Is the following LBYL:foo = 123if foo < 200:    do()If so, how to change to EAFP?Thanks!Sent from Samsung tablet. -- https://mail.python.org/mailman/listinfo/python-list

.0 in name

2022-05-13 Thread bryangan41
May I know (1) why can the name start with a number?(2) where in the doc is it?!>>> import pdb>>> pdb.run('(a for a in "")')> (1)()(Pdb) s--Call--> (1)()(Pdb) a.0 = (Pdb) c>>>Sent from Samsung tablet. -- https://mail.python.org/mailman/listinfo/python-list

Re: Changing calling sequence

2022-05-13 Thread Martin Di Paola
You probably want something like overload/multiple dispatch. I quick search on PyPI yields a 'multipledispatch' package. I never used, however. On Wed, May 11, 2022 at 08:36:26AM -0700, Tobiah wrote: On 5/11/22 06:33, Michael F. Stemper wrote: I have a function that I use to retrieve daily

Re: Accuracy of multiprocessing.Queue.qsize before any Queue.get invocations?

2022-05-13 Thread Martin Di Paola
If the queue was not shared to any other process, I would guess that its size is reliable. However, a plain counter could be much simpler/safer. The developer of multiprocessing.Queue, implemented size() thinking in how to share the size and maintain a reasonable consistency between process.

Re: tail

2022-05-13 Thread 2QdxY4RzWzUUiLuE
On 2022-05-13 at 12:16:57 +0200, Marco Sulla wrote: > On Fri, 13 May 2022 at 00:31, Cameron Simpson wrote: [...] > > This is nearly the worst "specification" I have ever seen. > You're lucky. I've seen much worse (or no one). At least with *no* documentation, the source code stands for

Re: tail

2022-05-13 Thread Marco Sulla
On Fri, 13 May 2022 at 00:31, Cameron Simpson wrote: > On 12May2022 19:48, Marco Sulla wrote: > >On Thu, 12 May 2022 at 00:50, Stefan Ram wrote: > >> There's no spec/doc, so one can't even test it. > > > >Excuse me, you're very right. > > > >""" > >A function that "tails" the file. If you

Re: [Solved] Re: Windows registry PermissionError

2022-05-13 Thread Mike Dewhirst
On 13/05/2022 4:37 pm, Eryk Sun wrote: On 5/13/22, Mike Dewhirst wrote: On 13/05/2022 4:14 pm, Eryk Sun wrote: Since self.connect() is always called, you should document that the initial hkey parameter has to be one of the following predefined key handles: HKEY_LOCAL_MACHINE

Re: [Solved] Re: Windows registry PermissionError

2022-05-13 Thread Eryk Sun
On 5/13/22, Mike Dewhirst wrote: > On 13/05/2022 4:14 pm, Eryk Sun wrote: >> Since self.connect() is always called, you should document that the >> initial hkey parameter has to be one of the following predefined key >> handles: >> >> HKEY_LOCAL_MACHINE >> HKEY_USERS > > I'm targeting

Re: [Solved] Re: Windows registry PermissionError

2022-05-13 Thread Mike Dewhirst
On 13/05/2022 4:14 pm, Eryk Sun wrote: Since self.connect() is always called, you should document that the initial hkey parameter has to be one of the following predefined key handles: HKEY_LOCAL_MACHINE HKEY_USERS I'm targeting HKEY_CURRENT_USER so I assume HK_USERS includes that.

Re: [Solved] Re: Windows registry PermissionError

2022-05-13 Thread Eryk Sun
Since self.connect() is always called, you should document that the initial hkey parameter has to be one of the following predefined key handles: HKEY_LOCAL_MACHINE HKEY_USERS HKEY_PERFORMANCE_DATA WinAPI RegConnectRegistryW() only matters when the target computer is a different