Changing 'Scripts/*.exe'

2022-10-01 Thread Gisle Vanem via Python-list
Hello list. I'm moved my old Python27 installation from f:\ProgramFiler\Python27 ( == 'ProgramFiles') to f:\gv\Python27 and now many 'scripts/*.exe' program fails to start since the old path to 'Python.exe' is wrong. E.g. 'Scripts/pip2.exe' has the path "f:\programfiler\python27\python.exe

Re: Changing 'Scripts/*.exe'

2022-10-03 Thread Gisle Vanem via Python-list
dn wrote: E.g. 'Scripts/pip2.exe' has the path "f:\programfiler\python27\python.exe" hard-coded inside it. Is there a easy way to fix this w/o re-installing this old Python? Yes, by putting a symbolic-link at the old 'programfiler' location which points to the new 'gv' installation. I'm sus

Re: for -- else: what was the motivation?

2022-10-10 Thread Jon Ribbens via Python-list
On 2022-10-10, Calvin Spealman wrote: > On Sat, Oct 8, 2022 at 5:35 PM rbowman wrote: >> On 10/7/22 21:32, Axy wrote: >> > So, seriously, why they needed else if the following pieces produce same >> > result? Does anyone know or remember their motivation? >> >> In real scenarios there would be mo

Re: for -- else: what was the motivation?

2022-10-10 Thread Robert Latest via Python-list
Chris Angelico wrote: > Yes, I'm aware that code readability becomes irrelevant for > short-duration projects. Beside the point. I'm wondering how important > it really is to have the shortest block first. I usually put the most expected / frequent / not negated block first if the whole if/else st

Re: for -- else: what was the motivation?

2022-10-10 Thread Robert Latest via Python-list
Grant Edwards wrote: > I've followed that advice for several decades. I find it much easier > to read code that's organized that way -- particularly when the > difference in block sizes is large (e.g. the first block is one line, > and the second is a a hundred). If any conditionally executed bloc

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
wrote: > Cameron, > > Your suggestion makes me shudder! Me, too > Removing all earlier lines of code is often guaranteed to generate errors as > variables you are using are not declared or initiated, modules are not > imported and so on. all of which aren't syntax errors, so the method should s

Re: for -- else: what was the motivation?

2022-10-10 Thread Robert Latest via Python-list
Axy wrote: >> Also not really a justification for "shortest block first". Wanting >> some elaboration on that. What's the value in it? > > Well, the value is productivity. No need to save puzzles "what this > hanging else belongs to?" If you find yourself asking that question, the if-block is pro

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
Michael F. Stemper wrote: > How does one declare a variable in python? Sometimes it'd be nice to > be able to have declarations and any undeclared variable be flagged. To my knowledge, the closest to that is using __slots__ in class definitions. Many a time have I assigned to misspelled class memb

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Robert Latest via Python-list
Antoon Pardon wrote: > I would like a tool that tries to find as many syntax errors as possible > in a python file. I'm puzzled as to when such a tool would be needed. How many syntax errors can you realistically put into a single Python file before compiling it for the first time? -- https://m

How to fix Python error, The term '.../python.exe' is not recognized as the name of a cmdlet, function, script file, or operable program, in VS Code?

2022-10-11 Thread LouisAden Capellupo via Python-list
Hi! I've just downloaded and installed Python 3.10.7 (64-bit) for Windows 10 from python.org. I'm quite new but, I've already downloaded and installed Visual Studio Code as well. I have included the two paths for python under User Variables.  C:\Users\It'sMeLil'Loui\AppData\Local\Programs\P

Fail 3.10.8 version installation on Windows 11 21H2

2022-10-12 Thread Kirill Ratkin via Python-list
Hi All, Do anyone face issue like in log below? I got last installer (3.10.8) and try to install it 'for all users' with downloading precompiled (pdb) files. And installation fails saying permission error. Installer says downloading error in the log. I repeated it three times with same re

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Michael F. Stemper wrote: > On 12/10/2022 07.20, Chris Green wrote: >> ... and rm will just about always be in /usr/bin. > > On two different versions of Ubuntu, it's in /bin. It will almost always be in /bin in any Unix or Unix-like system, because it's one of the fundamental util

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Joe Pfeiffer wrote: > Jon Ribbens writes: > >> On 2022-10-12, Michael F. Stemper wrote: >>> On 12/10/2022 07.20, Chris Green wrote: ... and rm will just about always be in /usr/bin. >>> >>> On two different versions of Ubuntu, it's in /bin. >> >> It will almost always be in /

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 05:00 de 12/10/22, Paulo da Silva escreveu: >> Hi! >> >> The simple question: How do I find the full path of a shell command >> (linux), i.e. how do I obtain the corresponding of, for example, >> "type rm" in command line? >> >> The reason: >> I have py

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Jon Ribbens wrote: > On 2022-10-12, Joe Pfeiffer wrote: >> Jon Ribbens writes: >> >>> On 2022-10-12, Michael F. Stemper wrote: On 12/10/2022 07.20, Chris Green wrote: > ... and rm will just about always be in /usr/bin. On two different versions of Ubuntu, it's

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 19:14 de 12/10/22, Jon Ribbens escreveu: >> On 2022-10-12, Paulo da Silva wrote: >>> Às 05:00 de 12/10/22, Paulo da Silva escreveu: Hi! The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain t

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Jon Ribbens wrote: > On 2022-10-12, Paulo da Silva wrote: >> Às 19:14 de 12/10/22, Jon Ribbens escreveu: >>> On 2022-10-12, Paulo da Silva wrote: Às 05:00 de 12/10/22, Paulo da Silva escreveu: > Hi! > > The simple question: How do I find the full path of a shell c

Re: Find the path of a shell command

2022-10-13 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 22:38 de 12/10/22, Jon Ribbens escreveu: >> On 2022-10-12, Jon Ribbens wrote: >>> On 2022-10-12, Paulo da Silva wrote: Às 19:14 de 12/10/22, Jon Ribbens escreveu: > On 2022-10-12, Paulo da Silva > wrote: >> Às 05:00 de 12/10/22, Paulo

Re: for -- else: what was the motivation?

2022-10-14 Thread Rob Cliffe via Python-list
I too have occasionally used for ... else.  It does have its uses. But oh, how I wish it had been called something else more meaningful, whether 'nobreak' or whatever.  It used to really confuse me.  Now I've learned to mentally replace "else" by "if nobreak", it confuses me a bit less. Rob Cl

Re: for -- else: what was the motivation?

2022-10-17 Thread Robert Latest via Python-list
wrote: > I had another crazy thought that I AM NOT ASKING anyone to do. OK? > > I was wondering about a sort of catch method you could use that generates a > pseudo-signal only when the enclosed preceding loop exits normally as a > sort of way to handle the ELSE need without the use of a keyword

xml.etree and namespaces -- why?

2022-10-19 Thread Robert Latest via Python-list
Hi all, For the impatient: Below the longish text is a fully self-contained Python example that illustrates my problem. I'm struggling to understand xml.etree's handling of namespaces. I'm trying to parse an Inkscape document which uses several namespaces. From etree's documentation: If the

Re: xml.etree and namespaces -- why?

2022-10-19 Thread Jon Ribbens via Python-list
On 2022-10-19, Robert Latest wrote: > If the XML input has namespaces, tags and attributes with prefixes > in the form prefix:sometag get expanded to {uri}sometag where the > prefix is replaced by the full URI. > > Which means that given an Element e, I cannot directly access its attri

Re: xml.etree and namespaces -- why?

2022-10-19 Thread Robert Latest via Python-list
Jon Ribbens wrote: > That's because you *always* need to know the URI of the namespace, > because that's its only meaningful identifier. If you assume that a > particular namespace always uses the same prefix then your code will be > completely broken. The following two pieces of XML should be unde

Re: Need help with custom string formatter

2022-10-21 Thread Robert Latest via Python-list
Hi Stefan, I have now implemented a version of this, works nicely. I have a few minor questions / remarks: > result += ' ' *( length - len( result )) Nice, I didn't know that one could multiply strings by negative numbers without error. > def __init__( self ): > super().__init_

Need help with custom string formatter

2022-10-21 Thread Robert Latest via Python-list
Hi all, I would like to modify the standard str.format() in a way that when the input field is of type str, there is some character replacement, and the string gets padded or truncated to the given field width. Basically like this: fmt = MagicString('<{s:6}>') print(fmt.format(s='Äußerst')) Outp

Re: Need help with custom string formatter

2022-10-21 Thread Robert Latest via Python-list
Stefan Ram wrote: [the solution] thanks, right on the spot. I had already figured out that format_field() is the one method I need, and thanks for the str.translate method. I knew that raking seven RE's across the same string HAD to be stupid. Have a nice weekend! -- https://mail.python.org/ma

Re: Need help with custom string formatter

2022-10-22 Thread Robert Latest via Python-list
Cameron Simpson wrote: > Stefan's code implements it's own format_field and falls back to the > original format_field(). That's standard subclassing practice, and worth > doing reflexively more of the time - it avoids _knowing_ that > format_field() just calls format(). > > So I'd take Stefan's

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Jon Ribbens via Python-list
On 2022-10-24, Chris Angelico wrote: > On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote: >> Yes, I got that. What I wanted to say was that this is indeed a bug in >> html.parser and not an error (or sloppyness, as you called it) in the >> input or ambiguity in the HTML standard. > > I describe

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Jon Ribbens via Python-list
On 2022-10-24, Chris Angelico wrote: > On Tue, 25 Oct 2022 at 02:45, Jon Ribbens via Python-list > wrote: >> >> On 2022-10-24, Chris Angelico wrote: >> > On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote: >> >> Yes, I got that. What I wanted

Re: Persisting functions typed into the shell

2022-11-12 Thread Wayne Harris via Python-list
On 12/11/2022 10:01, Stefan Ram wrote: > Many readers here know interactive Python sessions with > prompts like ">>>". But a "session" could be something else. > One could imagine that when starting a new session, one > still sees all the variables and constants defined in > preceding s

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

2022-11-13 Thread Jon Ribbens via Python-list
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] > x.clear > print(len(x)) > 3 > > at terminal: > x = [1,2,3] > x.clear > > print(len(x)) > 3 > > > Caused me an hour of frustration before I noticed list.clear() was

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

2022-11-13 Thread Jon Ribbens via Python-list
On 2022-11-13, 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] >>> x.clear >>> print(len(x)) >>> 3 >>> >>> at terminal: >>> x = [1,2,3] >>>

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

2022-11-13 Thread Jon Ribbens via Python-list
On 2022-11-14, Greg Ewing wrote: > On 14/11/22 1:31 pm, Jon Ribbens wrote: >> On 2022-11-13, DFS wrote: >>> But why is it allowed in the first place? >> >> Because it's an expression, and you're allowed to execute expressions. > > To put it a bit more clearly, you're allowed to evaluate > an exp

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, lin

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 call

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 [email protected]: > > >> On 14 Nov 2022, at 19:10, Jen Kris via Python-list >> wrote: >> >

Re: is mypy failing here

2022-11-24 Thread Kirill Ratkin via Python-list
Hi Robin, mypy --strict gives you detail info. On Thu, Nov 24, 2022 at 10:05 +, Robin Becker wrote: > I haven't used dataclasses or typing very much, but while playing about I > found this didn't give me an expected error > > (.py312) robin@minikat:~/devel/reportlab > $ cat tmp/examples/tdc

Bug report - Python 3.10 from Microsoft Store - IDLE won't start

2022-11-29 Thread Johan Gunnarsson via Python-list
Hello, IDLE won't start if ver. 3.10 is installed from Microsoft Store. 3.9 works just fine. Thanks in advance! Johan Gunnarsson Lunds universitet Medicinska fakulteten Bibliotek & IKT Box 118, 221 00 Lund Besöksadress: Sölvegatan 19, 221 84 Lund

pip issue

2022-11-30 Thread Gisle Vanem via Python-list
Hello list. I have an issue with 'pip v. 22.3.1'. On any 'pip install' command I get warning like this: c:\> pip3 install asciinema WARNING: Ignoring invalid distribution -arkupsafe (f:\gv\python310\lib\site-packages) WARNING: Ignoring invalid distribution -arkupsafe (f:\gv\python310\lib\

Re: pip issue

2022-11-30 Thread Gisle Vanem via Python-list
Dieter Maurer wrote: Otherwise no issues. But where is this text "-arkupsafe" stored and how to get rid it it? I've searched through all of my .pth files and found no such string. Have you looked at the content of the folder mentioned in the warnings (e.g. `...\site-packages`). I had 2 folde

Re: FTP without username and password

2022-12-06 Thread Jon Ribbens via Python-list
On 2022-12-06, ^Bart wrote: > Hi Guys, > > usually I use this code on my Debian Bullseye: > > # python3 -m pyftpdlib -i 192.168.0.71 -p 21 -d /home/my_user/ftp > > It works, it's simply easy and perfect but... a device in my lan needs a > ftp folder without username and password! > > I tried to s

How to get the needed version of a dependency

2022-12-14 Thread Cecil Westerhof via Python-list
If I want to know the dependencies for requests I use: pip show requests And one of the lines I get is: Requires: certifi, charset-normalizer, idna, urllib3 But I want (in this case) to know with version of charset-normalizer requests needs. How do I get that? -- Cecil Westerhof Senior

Re: How to get the needed version of a dependency

2022-12-14 Thread Cecil Westerhof via Python-list
DFS writes: > On 12/14/2022 3:55 AM, Cecil Westerhof wrote: >> If I want to know the dependencies for requests I use: >> pip show requests >> And one of the lines I get is: >> Requires: certifi, charset-normalizer, idna, urllib3 >> But I want (in this case) to know with version of chars

Re: Single line if statement with a continue

2022-12-15 Thread Cecil Westerhof via Python-list
[email protected] (Stefan Ram) writes: >>"No multiple returns" is often found in programming guidelines. > > I religiously followed that when I did more C programming > than today. Then, I read an article about how the result > pattern makes functions measurably slower. (It should not

Re: Single line if statement with a continue

2022-12-17 Thread Rob Cliffe via Python-list
On 15/12/2022 04:35, Chris Angelico wrote: On Thu, 15 Dec 2022 at 14:41, Aaron P wrote: I occasionally run across something like: for idx, thing in enumerate(things): if idx == 103: continue do_something_with(thing) It seems more succinct and cleaner to use: if idx == 10

Re: Top level of a recursive function

2022-12-17 Thread Rob Cliffe via Python-list
On 14/12/2022 13:49, Stefan Ram wrote: I also found an example similar to what was discussed here in pypy's library file "...\Lib\_tkinter\__init__.py": |def _flatten(item): |def _flatten1(output, item, depth): |if depth > 1000: |raise ValueError("nesting too deep i

Re: Why can't the pointer in a PyCapsule be NULL?

2022-12-30 Thread Robert Latest via Python-list
Stefan Ram wrote: > Robert Latest writes: >>the question is in the subject. I'd like the pointer to be able to be NULL >>because that would make my code slightly cleaner. No big deal though. > > In Usenet, it is considered good style to have all relevant > content in the body. Makes sense. >

Why can't the pointer in a PyCapsule be NULL?

2022-12-30 Thread Robert Latest via Python-list
Hi all, the question is in the subject. I'd like the pointer to be able to be NULL because that would make my code slightly cleaner. No big deal though. -- https://mail.python.org/mailman/listinfo/python-list

To clarify how Python handles two equal objects

2023-01-10 Thread Jen Kris via Python-list
I am writing a spot speedup in assembly language for a short but computation-intensive Python loop, and I discovered something about Python array handling that I would like to clarify.  For a simplified example, I created a matrix mx1 and assigned the array arr1 to the third row of the matrix:

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Jen Kris via Python-list
> On Wed, 11 Jan 2023 at 07:14, Jen Kris via Python-list > wrote: > >> >> I am writing a spot speedup in assembly language for a short but >> computation-intensive Python loop, and I discovered something about Python >> array handling that I would like to clarify.

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Jen Kris via Python-list
matrix operations, you might use NumPy. Its > arrays and matrices are heavily optimized for fast processing and provide > many useful operations on them. No use calling out to C code yourself when > NumPy has been refining that for many years. > > On 1/10/2023 4:10 PM

Re: To clarify how Python handles two equal objects

2023-01-11 Thread Jen Kris via Python-list
Yes, I did understand that.  In your example, "a" and "b" are the same pointer, so an operation on one is an operation on the other (because they’re the same memory block).  My issue in Python came up because Python can dynamically change one or the other to a different object (memory block) so

Re: To clarify how Python handles two equal objects

2023-01-11 Thread Jen Kris via Python-list
023 om 16:33 schreef Jen Kris via Python-list: > >> Yes, I did understand that.  In your example, "a" and "b" are the same >> pointer, so an operation on one is an operation on the other (because >> they’re the same memory block). >> > > Sorry if

RE: To clarify how Python handles two equal objects

2023-01-13 Thread Jen Kris via Python-list
other data > structure. Of course, if anything else is accessing the result in the > original in between, it won't work. > > Just FYI, a similar analysis applies to uses of the numpy and pandas and > other modules if you get some kind of object holding indices to a series s

Re: To clarify how Python handles two equal objects

2023-01-13 Thread Jen Kris via Python-list
34 >   >>> b=1234 >   >>> a is b >   False > > Not sure what happens if you manipulate the data referenced by 'b' in the > first example thinking you are changing something referred to by 'a' ... but > you might be smart to NOT th

RE: To clarify how Python handles two equal objects

2023-01-14 Thread Jen Kris via Python-list
a) > 3 > sys.getrefcount(b) > 3 > c = b > d = a > sys.getrefcount(a) > 5 > sys.getrefcount(d) > 5 > del(a) > sys.getrefcount(d) > 4 > b = "something else" > sys.getrefcount(d) > 3 > > So, in theory, you could carefully write your code to C

Re: To clarify how Python handles two equal objects

2023-01-14 Thread Jen Kris via Python-list
Yes, in fact I asked my original question – "I discovered something about Python array handling that I would like to clarify" -- because I saw that Python did it that way.  Jan 14, 2023, 15:51 by [email protected]: > On Sun, 15 Jan 2023 at 10:32, Jen Kris via Python-list >

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Jon Ribbens via Python-list
On 2023-01-20, Dino wrote: > > let's say I have this list of nested dicts: > > [ >{ "some_key": {'a':1, 'b':2}}, >{ "some_other_key": {'a':3, 'b':4}} > ] > > I need to turn this into: > > [ >{ "value": "some_key", 'a':1, 'b':2}, >{ "value": "some_other_key", 'a':3, 'b':4} > ] [{"v

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Rob Cliffe via Python-list
On 20/01/2023 15:29, Dino wrote: let's say I have this list of nested dicts: [   { "some_key": {'a':1, 'b':2}},   { "some_other_key": {'a':3, 'b':4}} ] I need to turn this into: [   { "value": "some_key", 'a':1, 'b':2},   { "value": "some_other_key", 'a':3, 'b':4} ] Assuming that I believe t

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Mike Baskin via Python-list
Stop please Sent from Yahoo Mail for iPhone On Tuesday, January 24, 2023, 1:05 AM, Cameron Simpson wrote: On 23Jan2023 17:58, Jach Feng wrote: parser.parse_args(['--', 'infix2postfix.py', '-4.3+5']) >usage: [-h] infix >: error: unrecognized arguments: -4.3+5 This error doesn't look lik

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Mike Baskin via Python-list
Can you stop please Sent from Yahoo Mail for iPhone On Tuesday, January 24, 2023, 10:12 AM, Thomas Passin wrote: On 1/23/2023 9:12 PM, Chris Angelico wrote: > On Tue, 24 Jan 2023 at 13:09, Jach Feng wrote: >> >> Chris Angelico 在 2023年1月24日 星期二清晨5:00:27 [UTC+8] 的信中寫道: >>> On Tue, 24 Jan 2023

Re: bool and int

2023-01-24 Thread Mike Baskin via Python-list
Will all of you please stop sending me emails Sent from my iPhone > On Jan 24, 2023, at 2:59 PM, rbowman wrote: > > On Mon, 23 Jan 2023 23:22:00 -0500, Dino wrote: > >> $ python Python 3.8.10 (default, Mar 15 2022, 12:22:08) >> [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "lice

Re: Evaluation of variable as f-string

2023-01-27 Thread Rob Cliffe via Python-list
On 25/01/2023 19:38, Thomas Passin wrote: Stack overflow to the rescue: Search phrase:  "python evaluate string as fstring" https://stackoverflow.com/questions/47339121/how-do-i-convert-a-string-into-an-f-string def effify(non_f_str: str):     return eval(f'f"""{non_f_str}"""') print(ef

Re: bool and int

2023-01-27 Thread Rob Cliffe via Python-list
On 24/01/2023 04:22, Dino wrote: $ python Python 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> b = True >>> isinstance(b,bool) True >>> isinstance(b,int) True >>> That immediately tells you that either

Re: Evaluation of variable as f-string

2023-01-27 Thread Rob Cliffe via Python-list
On 23/01/2023 18:02, Chris Angelico wrote: On Tue, 24 Jan 2023 at 04:56, Johannes Bauer wrote: Hi there, is there an easy way to evaluate a string stored in a variable as if it were an f-string at runtime? ... This is supposedly for security reasons. However, when trying to emulate this be

Re: Evaluation of variable as f-string

2023-01-27 Thread Rob Cliffe via Python-list
Whoa! Whoa! Whoa! I appreciate the points you are making, Chris, but I am a bit taken aback by such forceful language. On 27/01/2023 19:18, Chris Angelico wrote: On Sat, 28 Jan 2023 at 05:31, Rob Cliffe via Python-list wrote: On 23/01/2023 18:02, Chris Angelico wrote: Maybe, rather than

Re: Usenet vs. Mailing-list (was: evaluation question)

2023-01-28 Thread Jon Ribbens via Python-list
On 2023-01-28, Peter J. Holzer wrote: > On 2023-01-27 21:04:58 +, Ben Bacarisse wrote: >> It looks like you posted this question via Usenet. comp.lang.python is >> essentially dead as a Usenet group. It exists, and gets NNTP versions >> of mail sent to the mailing list, but nothing posted to

Re: Usenet vs. Mailing-list

2023-01-28 Thread Jon Ribbens via Python-list
On 2023-01-29, Ben Bacarisse wrote: > "Peter J. Holzer" writes: > >> On 2023-01-27 21:04:58 +, Ben Bacarisse wrote: >>> [email protected] writes: >>> >>> > Hi >>> >>> It looks like you posted this question via Usenet. comp.lang.python is >>> essentially dead as a Usenet group. It ex

Re: Usenet vs. Mailing-list

2023-01-29 Thread Jon Ribbens via Python-list
On 2023-01-29, Peter J. Holzer wrote: > On 2023-01-29 02:09:28 -, Jon Ribbens via Python-list wrote: >> I'm not aware of any significant period in the last twenty-one years >> that > [the gateway] >> hasn't been working. Although sometimes it does feel like

Re: evaluation question

2023-01-30 Thread Rob Cliffe via Python-list
On 30/01/2023 09:41, [email protected] wrote: On Sun, 29 Jan 2023 23:57:51 -0500 Thomas Passin wrote: On 1/29/2023 4:15 PM, [email protected] wrote: On 2023-01-28, Louis Krupp wrote: On 1/27/2023 9:37 AM, [email protected] wrote: eval("print(123)") 123 Does OP ex

Re: Evaluation of variable as f-string

2023-01-31 Thread Rob Cliffe via Python-list
On 27/01/2023 23:41, Chris Angelico wrote: On Sat, 28 Jan 2023 at 10:08, Rob Cliffe via Python-list wrote: Whoa! Whoa! Whoa! I appreciate the points you are making, Chris, but I am a bit taken aback by such forceful language. The exact same points have already been made, but not listened to

Re: Licensing?

2023-02-02 Thread Jon Ribbens via Python-list
On 2023-02-02, Stefan Ram wrote: > Many licenses in the Python world are like: "You can make > changes, but have to leave in my Copyright notice.". > > Would it be possible that the original author could not > claim a Copyright anymore when code has been changed? No. If you change someone

Re: Licensing?

2023-02-02 Thread Jon Ribbens via Python-list
On 2023-02-03, Greg Ewing wrote: > On 3/02/23 6:38 am, Jon Ribbens wrote: >> If you change someone else's code then you have created a derived >> work, which requires permission from both the original author and you >> to copy. (Unless you change it so much that nothing remains of the >> original

Re: Organizing modules and their code

2023-02-04 Thread Greg Ewing via Python-list
On 5/02/23 11:18 am, transreductionist wrote: This analogy came to me the other day. For me, I would rather walk into a grocery store where the bananas, apples, and oranges are separated in to their own bins, instead of one common crate. On the other hand, if the store has an entire aisle dev

Re: Organizing modules and their code

2023-02-05 Thread Greg Ewing via Python-list
On 6/02/23 4:23 am, Weatherby,Gerard wrote: Well, first of all, while there is no doubt as to Dijkstra’s contribution to computer science, I don’t think his description of scientific thought is correct. The acceptance of Einstein’s theory of relativity has nothing to do with internal consisten

Re: evaluation question

2023-02-06 Thread Rob Cliffe via Python-list
On 02/02/2023 09:31, [email protected] wrote: On Wed, 1 Feb 2023 18:28:04 +0100 "Peter J. Holzer" wrote: --b2nljkb3mdefsdhx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2023-02-01 09:00:39 -, mutt...@dastardly

Re: Evaluation of variable as f-string

2023-02-07 Thread Rob Cliffe via Python-list
[re-sending this to both the list and to Chris, as a prior send to the list only was bounced back] On 31/01/2023 22:33, Chris Angelico wrote: Thanks for clarifying. Hm. So 'x' is neither in locals() nor in globals(). Which starts me wondering (to go off on a tangent): Should there be a nonlo

Re: evaluation question

2023-02-07 Thread Rob Cliffe via Python-list
On 07/02/2023 08:15, Chris Angelico wrote: On Tue, 7 Feb 2023 at 18:49, Rob Cliffe via Python-list wrote: On 02/02/2023 09:31, [email protected] wrote: On Wed, 1 Feb 2023 18:28:04 +0100 "Peter J. Holzer" wrote: --b2nljkb3mdefsdhx Content-Type: text/plain; charset=us-asc

Re: ChatGPT Generated news poster code

2023-02-10 Thread Greg Ewing via Python-list
For a moment I thought this was going to be a script that uses ChatGPT to generate a random news post and post it to Usenet... Which would also have been kind of cool, as long as it wasn't overused. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: ChatGPT Generated news poster code

2023-02-12 Thread Roland Müller via Python-list
Hello, On 2/11/23 03:31, Greg Ewing via Python-list wrote: For a moment I thought this was going to be a script that uses ChatGPT to generate a random news post and post it to Usenet... Which would also have been kind of cool, as long as it wasn't overused. Actually, I like cynical humo

Python 3.8 pip installation on Windows 7

2023-02-14 Thread christoph sobotta via Python-list
Hello, The installation file Python-3.8.10.exe (last version compatible with Windows 7 (32 bit) ? ) does not automatically install pip on Windows 7. Are there compatibility problems with Windows 7 ? See attachment log file Greetings C.Sobotta ... MSI (s) (3C:FC) [13:32:28:993]: Hello, I'm your

Re: Comparing caching strategies

2023-02-16 Thread Rob Cliffe via Python-list
On 11/02/2023 00:39, Dino wrote: First off, a big shout out to Peter J. Holzer, who mentioned roaring bitmaps a few days ago and led me to quite a discovery. I was intrigued to hear about roaring bitmaps and discover they really were a thing (not a typo as I suspected at first). What next, I

Re: Precision Tail-off?

2023-02-17 Thread Greg Ewing via Python-list
On 18/02/23 7:42 am, Richard Damon wrote: On 2/17/23 5:27 AM, Stephen Tucker wrote: None of the digits in RootNZZZ's string should be different from the corresponding digits in RootN. Only if the storage format was DECIMAL. Note that using decimal wouldn't eliminate this particular problem,

Re: LRU cache

2023-02-18 Thread Rob Cliffe via Python-list
On 18/02/2023 15:29, Thomas Passin wrote: On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote:     I sometimes use this trick, which I learnt from a book by Martelli.     Instead of try/except, membership testing with "in" (__contains__) might     be faster. Probably "depends". Matter of measuring

Line continuation and comments

2023-02-22 Thread Robert Latest via Python-list
I found myself building a complicated logical condition with many ands and ors which I made more manageable by putting the various terms on individual lines and breaking them with the "\" line continuation character. In this context it would have been nice to be able to add comments to lines terms

Re: semi colonic

2023-02-22 Thread Rob Cliffe via Python-list
On 23/02/2023 02:04, Thomas Passin wrote: On 2/22/2023 7:58 PM, [email protected] wrote: So can anyone point to places in Python where a semicolon is part of a best or even good way to do anything?  I use the semicolon (once in a while) is for quick debugging.  I might add as line l

Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Greg Ewing via Python-list
On 23/02/23 9:12 am, Hen Hanna wrote: On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote: def f(a): print(black_magic(a))# or black_magic('a') f(v1)# prints: v1 f(v2)# prints: v2 the ter

Re: semi colonic

2023-02-22 Thread Greg Ewing via Python-list
On 23/02/23 1:58 pm, [email protected] wrote: Would anything serious break if it was deprecated for use as a statement terminator? Well, it would break all the code of people who like to write code that way. They might get a bit miffed if we decide that their code is not serious. :-) On t

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-22 Thread Greg Ewing via Python-list
On 23/02/23 9:37 am, Hen Hanna wrote: for the first several weeks... whenever i used Python... all i could think ofwas this is really Lisp (inside) with a thin veil of Java/Pascal syntax.. - that everything is first converted

Re: LRU cache

2023-02-22 Thread Rob Cliffe via Python-list
On 18/02/2023 17:19, Albert-Jan Roskam wrote: On Feb 18, 2023 17:28, Rob Cliffe via Python-list wrote: On 18/02/2023 15:29, Thomas Passin wrote: > On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote: >>     I sometimes use this trick, which I learnt from a book by

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread Rob Cliffe via Python-list
On 22/02/2023 20:05, Hen Hanna wrote: Python makes programming (debugging) so easy I agree with that! Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: semi colonic

2023-02-23 Thread Rob Cliffe via Python-list
On 23/02/2023 00:58, [email protected] wrote: So can anyone point to places in Python where a semicolon is part of a best or even good way to do anything? Yes.  Take this bit of toy code which I just dreamed up.  (Of course it is toy code; don't bother telling me how it could be written

Re: semi colonic

2023-02-23 Thread Rob Cliffe via Python-list
On 23/02/2023 02:25, Hen Hanna wrote: i sometimes put extra commas... as: [ 1, 2, 3, 4, ] That is a good idea. Even more so when the items are on separate lines:     [         "spam",         "eggs",         "cheese",     ] and you may want to chang

Re: Line continuation and comments

2023-02-23 Thread Rob Cliffe via Python-list
On 22/02/2023 15:23, Paul Bryan wrote: Adding to this, there should be no reason now in recent versions of Python to ever use line continuation. Black goes so far as to state "backslashes are bad and should never be used": https://black.readthedocs.io/en/stable/the_black_code_style/future_styl

Re: semi colonic

2023-02-23 Thread Greg Ewing via Python-list
On 24/02/23 9:26 am, [email protected] wrote: Python One-Liners: Write Concise, Eloquent Python Like a Professional Illustrated Edition by Christian Mayer (Author) I didn't know there were any Professional Illustrated Editions writing Pythom. You learn something every day! :-) -- Greg --

Re: TypeError: can only concatenate str (not "int") to str

2023-02-25 Thread Greg Ewing via Python-list
On 26/02/23 10:53 am, Paul Rubin wrote: I'm not on either list but the purpose of the tutor list is to shunt beginner questions away from the main list. There's a fundamental problem with tutor lists. They rely on experienced people, the ones capable of answering the questions, to go out of the

Re: Is there a more efficient threading lock?

2023-02-25 Thread Jon Ribbens via Python-list
On 2023-02-25, Paul Rubin wrote: > Skip Montanaro writes: >> from threading import Lock > > 1) you generally want to use RLock rather than Lock Why? > 2) I have generally felt that using locks at the app level at all is an > antipattern. The main way I've stayed sane in multi-threaded Python >

Re: Is there a more efficient threading lock?

2023-02-25 Thread Jon Ribbens via Python-list
On 2023-02-25, Paul Rubin wrote: > Jon Ribbens writes: >>> 1) you generally want to use RLock rather than Lock >> Why? > > So that a thread that tries to acquire it twice doesn't block itself, > etc. Look at the threading lib docs for more info. Yes, I know what the docs say, I was asking why y

Re: Is there a more efficient threading lock?

2023-02-26 Thread Jon Ribbens via Python-list
On 2023-02-26, Barry Scott wrote: > On 25/02/2023 23:45, Jon Ribbens via Python-list wrote: >> I think it is the case that x += 1 is atomic but foo.x += 1 is not. > > No that is not true, and has never been true. > >:>>> def x(a): >:...    a += 1 >:... >

Re: Is there a more efficient threading lock?

2023-02-26 Thread Jon Ribbens via Python-list
On 2023-02-26, Chris Angelico wrote: > On Sun, 26 Feb 2023 at 16:16, Jon Ribbens via Python-list > wrote: >> On 2023-02-25, Paul Rubin wrote: >> > The GIL is an evil thing, but it has been around for so long that most >> > of us have gotten used to it, and some u

<    13   14   15   16   17   18   19   20   21   22   >