RE: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread avi.e.gross
Cameron, What would be the meaning of an ordering relation determining what is MORE VALID? As has been pointed out, not only are some uses that look odd sometimes valid, but perhaps even can be used in ways you simply may not see, such as side effects. Some examples ranging from poor to horrible

Re: Are these good ideas?

2022-11-14 Thread Axy via Python-list
On 15/11/2022 04:36, Dan Stromberg wrote: On Mon, Nov 14, 2022 at 11:33 AM Axy via Python-list wrote: On 14/11/2022 17:14, Stephen Tucker wrote: > Hi, > > I have two related issues I'd like comments on. > > Issue 1 - Global Values Your "global variables" module

Re: Are these good ideas?

2022-11-14 Thread Dan Stromberg
On Mon, Nov 14, 2022 at 11:33 AM Axy via Python-list wrote: > On 14/11/2022 17:14, Stephen Tucker wrote: > > Hi, > > > > I have two related issues I'd like comments on. > > > > Issue 1 - Global Values > > Your "global variables" module acts exactly as a singleton class. > Which is apparently a

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Cameron Simpson
On 14Nov2022 19:15, Dennis Lee Bieber wrote: There is also the minor facet that "x.clear" can be bound to a different name... x = [1, 2, 3.145926536, "Pie"] clearx = x.clear x [1, 2, 3.145926536, 'Pie'] clearx() x [] I think the OP would take the stance that this: clearx =

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Dennis Lee Bieber
On Tue, 15 Nov 2022 09:11:10 +1100, Cameron Simpson declaimed the following: >On 13Nov2022 22:23, DFS wrote: >>This is an easy check for the interpreter to make. > >It really isn't, given that (a) this isn't known by the interpreter to >be a `list` until runtime and (b) that would need

Re: Debugging Python C extensions with GDB

2022-11-14 Thread Jen Kris via Python-list
Thanks for your reply.  Victor's article didn't mention ctypes extensions, so I wanted to post a question before I build from source.  Nov 14, 2022, 14:32 by ba...@barrys-emacs.org: > > >> On 14 Nov 2022, at 19:10, Jen Kris via Python-list >> wrote: >> >> In September 2021, Victor Stinner

Re: Are these good ideas?

2022-11-14 Thread Thomas Passin
On 11/14/2022 5:36 PM, Barry wrote: On 14 Nov 2022, at 22:06, Thomas Passin wrote: For parameter passing like your #2, I have packaged them into a dictionary and passed that around. It was easy enough, and worked well. I used to use a dict but having been burnt with issues now create a

Re: Are these good ideas?

2022-11-14 Thread Barry
> On 14 Nov 2022, at 22:49, Chris Angelico wrote: > > On Tue, 15 Nov 2022 at 09:38, Barry wrote: >> >> >> On 14 Nov 2022, at 22:06, Thomas Passin wrote: >>> >>> For parameter passing like your #2, I have packaged them into a dictionary >>> and passed that around. It was easy

Re: Are these good ideas?

2022-11-14 Thread Chris Angelico
On Tue, 15 Nov 2022 at 09:38, Barry wrote: > > > > > On 14 Nov 2022, at 22:06, Thomas Passin wrote: > > > > For parameter passing like your #2, I have packaged them into a dictionary > > and passed that around. It was easy enough, and worked well. > > > I used to use a dict but having been

Re: Debugging Python C extensions with GDB

2022-11-14 Thread Barry
> On 14 Nov 2022, at 19:10, Jen Kris via Python-list > wrote: > > In September 2021, Victor Stinner wrote “Debugging Python C extensions with > GDB” > (https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9). > > > My

Re: Are these good ideas?

2022-11-14 Thread Barry
> On 14 Nov 2022, at 22:06, Thomas Passin wrote: > > For parameter passing like your #2, I have packaged them into a dictionary > and passed that around. It was easy enough, and worked well. > I used to use a dict but having been burnt with issues now create a class. With a class you can

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Cameron Simpson
On 13Nov2022 22:23, DFS wrote: On 11/13/2022 9:11 PM, Chris Angelico wrote: [ ... `x.clear` ... ] No part of it is invalid, so nothing causes a problem. For instance, you can write this: If it wastes time like that it's invalid. It's a valid expression. It looks to your eye like a no-op,

Re: Are these good ideas?

2022-11-14 Thread Thomas Passin
For parameter passing like your #2, I have packaged them into a dictionary and passed that around. It was easy enough, and worked well. The only potential problem is in documenting the key/value pairs the dictionary is supposed to contain. You had better make sure it's made clear somewhere,

Re: Are these good ideas?

2022-11-14 Thread Axy via Python-list
On 14/11/2022 17:14, Stephen Tucker wrote: Hi, I have two related issues I'd like comments on. Issue 1 - Global Values Your "global variables" module acts exactly as a singleton class. Funny, you could (and maybe you do) write in your functions import global_vars_module as self as the

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Chris Angelico
On Tue, 15 Nov 2022 at 05:57, Stefan Ram wrote: > > Michael Speer writes: > >Python doesn't care what an expression returns. > > In my English, functions return values, > expression are being evaluated to a value. > The evaluation of a function yields or > produces a value. Expressions

Debugging Python C extensions with GDB

2022-11-14 Thread Jen Kris via Python-list
In September 2021, Victor Stinner wrote “Debugging Python C extensions with GDB” (https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9).   My question is:  with Python 3.9+, can I debug into a C extension written in pure C and

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Jon Ribbens via Python-list
On 2022-11-14, Stefan Ram wrote: > Jon Ribbens writes: >>"""Create an array and print its length""" >>array = [1, 2, 3] >>array.clear > > BTW: Above, there are /two/ expression statements > with no effect; the other one is > > """Create an array and print its length""" > > . Apparently,

[Python-announce] python-oracledb 1.2.0

2022-11-14 Thread Anthony Tuininga
What is python-oracledb? python-oracledb is a Python extension module that enables access to Oracle Database for Python and conforms to the Python database API 2.0 specifications with a number of enhancements. This module is intended to eventually replace cx_Oracle. Where do I get it?

Re: Are these good ideas?

2022-11-14 Thread Weatherby,Gerard
Issue 1. Depends very much on your operating system and application environment. Issue 2. I usually make myself a data class to pass around. Then when I figure out I forgot something, I just update the dataclass and the creator and consumer of it. @dataclass class CallParameter:

Re: Are these good ideas?

2022-11-14 Thread Karsten Hilbert
Am Mon, Nov 14, 2022 at 05:14:05PM + schrieb Stephen Tucker: > Issue 2 - Passed Parameters > > I am now facing another situation where I am wanting to pass 6 or 7 > parameters down through several layers of logic (function A calling > function B calling ... ) and for results to be passed

Re: Are these good ideas?

2022-11-14 Thread Paul Bryan
Seems like this is a use case for context managers and/or context variables: https://docs.python.org/3/library/contextlib.html https://docs.python.org/3/library/contextvars.html On Mon, 2022-11-14 at 17:14 +, Stephen Tucker wrote: > Hi, > > I have two related issues I'd like comments on. >

Are these good ideas?

2022-11-14 Thread Stephen Tucker
Hi, I have two related issues I'd like comments on. Issue 1 - Global Values Some years ago, I had a situation where (a) I could supply low-level functions that carry out tasks, (b) I needed those functions to communicate with each other, but (c) I had no access to the module that invoked my

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-14 Thread darkstone
Dear list, >>So please check that you are running the right version of Python when >>you type "python". If i type “python”, it is C:\>python -V Python 3.11.0 Von: Thomas Passin Gesendet: ‎Sonntag‎, ‎13‎. ‎November‎ ‎2022 ‎16‎:‎18 An: darkst...@o2online.de On 11/13/2022

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Weatherby,Gerard
The terminal told you what x.clear was. The Python documentation tells you how to call it: https://docs.python.org/3/tutorial/datastructures.html list.clear() Remove all items from the list. Equivalent to del a[:]. An IDE (e.g. PyCharm) will try to autocomplete the parentheses and warn you if

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Karsten Hilbert
Am Mon, Nov 14, 2022 at 02:13:34AM + schrieb MRAB: > But if it's an expression where it's expecting a statement and it's not a > call, then > it's probably a bug. That "probably" makes it suitable for a linter, as was pointed out. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Roel Schroeven
Op 14/11/2022 om 4:23 schreef DFS: On 11/13/2022 9:11 PM, Chris Angelico wrote: On Mon, 14 Nov 2022 at 11:53, DFS wrote: On 11/13/2022 5:20 PM, Jon Ribbens wrote: On 2022-11-13, DFS wrote: In code, list.clear is just ignored. At the terminal, list.clear shows in code: x = [1,2,3]