Re: Best practice for config files?

2025-05-22 Thread Grant Edwards via Python-list
On 2025-05-23, Thomas Passin wrote: >> Alternatively look at the PATH envronment variable, which >> contains a list of directories separated by semicolons and which you can >> access as os.environ['PATH'] . > > There is really no reason for a config file to be on the system > path. On Unix/Lin

Re: Pip installs to unexpected place

2025-04-17 Thread Grant Edwards via Python-list
stem is never going to look in my ~/.local/lib/python* directories. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Pip installs to unexpected place

2025-04-16 Thread Grant Edwards via Python-list
On 2025-04-16, Mats Wichmann via Python-list wrote: > On 4/15/25 16:07, Grant Edwards via Python-list wrote: >> On 2025-04-15, Thomas Passin via Python-list wrote: >> >>> On Linux, at least, it's standard for pip to install into the user's >>> site

Re: Pip installs to unexpected place

2025-04-15 Thread Grant Edwards via Python-list
On 2025-04-15, Thomas Passin via Python-list wrote: > On Linux, at least, it's standard for pip to install into the user's > site-packages location if it's not invoked with admin privileges - even > without --user. Pip will emit a message saying so. Well, that used to be > true but nowadays Pi

Re: Version of OpenSSl ?

2025-02-10 Thread Grant Edwards via Python-list
On 2025-02-10, Chris Angelico via Python-list wrote: > On Tue, 11 Feb 2025 at 04:04, Grant Edwards via Python-list > wrote: >> On 2025-02-09, Left Right via Python-list wrote: >> >>> You need the sources of the OpenSSL library, not the compiled library. >>>

Re: Version of OpenSSl ?

2025-02-10 Thread Grant Edwards via Python-list
ained the library sources. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-17 Thread Grant Edwards via Python-list
rpreted by tputs/putp. The approach above only works if you only care about certain terminals, and you know that none of the terminfo strings you're using have those interal terminfo escape sequences in them [AFAIK, that's true for the linux console, xterm and the like, but not for many serial terminals.] -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-14 Thread Grant Edwards via Python-list
ndow and then do everything based on single-stroke "command keys" that print output in the lower part of the terminal window. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-14 Thread Grant Edwards via Python-list
On 2025-01-14, Alan Gauld via Python-list wrote: > On 14/01/2025 00:20, Grant Edwards via Python-list wrote: >> On 2025-01-13, Alan Gauld via Python-list wrote: >> >>> All of that is possible in curses, you just have to code it. >> >> All of that is easy w

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-13 Thread Grant Edwards via Python-list
On 2025-01-13, Alan Gauld via Python-list wrote: > All of that is possible in curses, you just have to code it. All of that is easy with curses in C. Unfortunately, the high level "panel" and "menu" curses subystems that make it easy aren't included in the Python curses API, so doing it in Pyht

Re: Python List is Not Dead

2024-12-30 Thread Grant Edwards via Python-list
there's > really nothing so good as usenet for proper discourse (!). Don't forget you can also read this list (and thousands of others) via the NNTP server at news.gmane.io. There really is no better way to read lists that with a good news client. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: it's a shame... python error over error

2024-12-16 Thread Grant Edwards via Python-list
On 2024-12-16, aotto1968 via Python-list wrote: > If I read the answers I come to the conclusion that the "supporters" > at python doesn't ever understand the problem. You should definitely demand to speak to the manager and request your money back. -- Grant -- ht

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-09-30 Thread Grant Edwards via Python-list
On 2024-09-30, Dan Sommers via Python-list wrote: > In Common Lisp, integers can be written in any integer base from two > to thirty six, inclusive. So knowing the last digit doesn't tell > you whether an integer is even or odd until you know the base > anyway. I had to think about that for an

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-09-30 Thread Grant Edwards via Python-list
On 2024-09-30, Dan Sommers via Python-list wrote: > On 2024-09-30 at 11:44:50 -0400, > Grant Edwards via Python-list wrote: > >> On 2024-09-30, Left Right via Python-list wrote: >> > [...] >> > Imagine a pathological case of this shape: 1... <60GB of digits&g

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-09-30 Thread Grant Edwards via Python-list
On 2024-09-30, Left Right via Python-list wrote: > Whether and to what degree you can stream JSON depends on JSON > structure. In general, however, JSON cannot be streamed (but commonly > it can be). > > Imagine a pathological case of this shape: 1... <60GB of digits>. This > is still a valid JSON

Re: Formatting a str as a number

2024-08-27 Thread Grant Edwards via Python-list
On 2024-08-27, Gilmeh Serda via Python-list wrote: > On 25 Aug 2024 15:46:25 GMT, Stefan Ram wrote: > >> f"{int(number):>20,}" > > Great. Thanks. Do you have a link to where that's documented? > > I did web search, found nothing. https://docs.python.org/3/library/string.html#formatspec https://do

Re: python C-api and thread

2024-08-05 Thread Grant Edwards via Python-list
her > "lock/GIL" etc. No, not using any OS I've ever seen. The usual definition of "threads" is that they share data, and the definition of "processes" is that processes don't share data. How exactly does what you're trying to do differ from runnig t

Re: Predicting an object over an pretrained model is not working

2024-07-31 Thread Grant Edwards via Python-list
g That depends on the training data and how the model works. You should probably do some reading on neural networks, machine learning, and pattern/object recognition. You appear to be trying to use tools without understanding what they do or how they work. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Anonymous email users

2024-06-24 Thread Grant Edwards via Python-list
ery close to 100% accurate at filtering them out. I can't remember the last time I actually got a spam message in my inbox. > A few years ago the spam count was greater than a 1,000 a month. I'm baffled. Is Gmail silently rejecting that much junk before it even gets to the filter th

Re: Anonymous email users

2024-06-18 Thread Grant Edwards via Python-list
converted to be one of the mailman 3 lists. Gmane used to have a usable search feature (along with a decent threaded web UI to read the arhives), but that got lost during the great gmane server/domain upheaval of 2016 (or whenever that was). I still miss it. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Anonymous email users

2024-06-17 Thread Grant Edwards via Python-list
hey almost always seem to be copies of replies that were also posted to the mailing list (which I read using an NNTP client pointed at news.gmane.io). -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread Grant Edwards via Python-list
On 2024-06-08, Larry Martell via Python-list wrote: > The original question struck me as homework or an interview question for a > junior position. But having no clear requirements or specifications is good > training for the real world where that is often the case. When you question > that, you

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-05 Thread Grant Edwards via Python-list
On 2024-06-05, dn via Python-list wrote: > If you/your teacher can't define a "word", the code, any code, will > almost-certainly be wrong! Back when I was a student... When there was a homework/project assignemnt with a vague requirement (and it wasn't practical to get the requirement refined

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread Grant Edwards via Python-list
On 2024-06-04, Edward Teach via Python-list wrote: > On Mon, 03 Jun 2024 14:58:26 -0400 (EDT) > Grant Edwards wrote: > >> On 2024-06-03, Edward Teach via Python-list >> wrote: >> >> > The Gutenburg Project publishes "plain text". That's ano

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-03 Thread Grant Edwards via Python-list
On 2024-06-03, Edward Teach via Python-list wrote: > The Gutenburg Project publishes "plain text". That's another > problem, because "plain text" means UTF-8and that means > unicode...and that means running some sort of unicode-to-ascii > conversion in order to get something like "words". A

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-05-31 Thread Grant Edwards via Python-list
On 2024-05-31, Pieter van Oostrum via Python-list wrote: > HenHanna writes: > >> Given a text file of a novel (JoyceUlysses.txt) ... >> >> could someone give me a pretty fast (and simple) Python program that'd >> give me a list of all words occurring exactly once? >> >> -- Also, a

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Grant Edwards via Python-list
On 2024-05-29, Mats Wichmann via Python-list wrote: > On 5/29/24 08:02, Grant Edwards via Python-list wrote: >> On 2024-05-29, Chris Angelico via Python-list wrote: >> >>> print(f"if block {name[index]=} {index=}") >> >> Holy cow! How did I not kn

Re: Flubbed it in the second interation through the string: range error... HOW?

2024-05-29 Thread Grant Edwards via Python-list
On 2024-05-29, Chris Angelico via Python-list wrote: > print(f"if block {name[index]=} {index=}") Holy cow! How did I not know about the f-string {=} thing? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-27 Thread Grant Edwards via Python-list
ome/user/apath', 'somefile')) as f: > print(f.read()) > ``` > > However, that is not the case. For me, that block formats as expected using Python markdown. What do you mean by "this code should work [...] that is not the case"? What markdown renderin

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-19 Thread Grant Edwards via Python-list
can't even use pip to do "user" installs? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-19 Thread Grant Edwards via Python-list
ty that was used to copy files around on CP/M and DEC's PDP-11 OSes. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-19 Thread Grant Edwards via Python-list
asonlly use pip to install something that isn't packaged for Gentoo, but it doesn't seem to cause problems — let alone nightmares. I also occasionally package something myself. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-18 Thread Grant Edwards via Python-list
On 2024-05-18, Mats Wichmann via Python-list wrote: > Distros have do offer a good selection of packaged Python bits, yes, but > only for the version of Python that's "native" to that distro release. > If you need to test other versions of Python, you're mostly on your own. For a few years I n

Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-18 Thread Grant Edwards via Python-list
7;t think Linux users have to deal with venvs any more than > Windows users. Maybe even less because many distributions come with > a decent set of Python packages. I've been using Python on Linux almost daily for 25 years, and I've yet to use a venv... -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Terminal Emulator

2024-05-14 Thread Grant Edwards via Python-list
On 2024-05-14, Alan Gauld via Python-list wrote: > On 14/05/2024 18:44, Gordinator via Python-list wrote: > >> I wish to write a terminal emulator in Python. I am a fairly >> competent Python user, and I wish to try a new project idea. What >> references can I use when writing my terminal emulator

Re: Terminal Emulator

2024-05-14 Thread Grant Edwards via Python-list
On 2024-05-14, Alan Gauld via Python-list wrote: > On 14/05/2024 18:44, Gordinator via Python-list wrote: > >> I wish to write a terminal emulator in Python. I am a fairly >> competent Python user, and I wish to try a new project idea. What >> references can I use when writing my terminal emulator

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
7;t want to use the ncurses windowing functions, here are some notes on how to do that: https://github.com/GrantEdwards/Python-curses-and-terminfo That too is C-Python oriented, and I don't really know how to do the same things using Jython. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
re you asking how to put a second escape sequence at the end of the string literal after the colon? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Grant Edwards via Python-list
On 2024-03-25, Loris Bennett via Python-list wrote: > Grant Edwards writes: > >> On 2024-03-22, Loris Bennett via Python-list wrote: >> >>> Yes, I was mistakenly thinking that the popping the element would >>> leave me with the dict minus the popped key-v

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Grant Edwards via Python-list
On 2024-03-22, Loris Bennett via Python-list wrote: > Yes, I was mistakenly thinking that the popping the element would > leave me with the dict minus the popped key-value pair. It does. > Seem like there is no such function. Yes, there is. You can do that with either pop or del: >>> d =

Re: the name ``wheel''

2024-03-21 Thread Grant Edwards via Python-list
On 2024-03-21, MRAB via Python-list wrote: > As it's recommended to use the Python Launcher py on Windows, I use > that instead: > > py -m pip install something > > because it gives better support if you have multiple versions of > Python installed. I adopted that practice years ago on Linux as

Re: Configuring an object via a dictionary

2024-03-15 Thread Grant Edwards via Python-list
On 2024-03-15, Thomas Passin via Python-list wrote: > On 3/15/2024 5:30 AM, Loris Bennett via Python-list wrote: >> Hi, >> >> I am initialising an object via the following: >> >> def __init__(self, config): >> >> self.connection = None >> >> self.source_name = config['so

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Thomas Passin via Python-list wrote: > >> Hi, I tested this with Python 3.8. Good to know that this was fixed! > > We just learned a few posts back that it might be specific to Linux; I > ran it on Windows. On Linux, the limit is imposed by the filesystem. Most of the "real" file

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Grant Edwards via Python-list wrote: >> OSError: [Errno 36] File name to

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Grant Edwards via Python-list wrote: > On 2024-03-08, Thomas Passin via Python-list wrote: >> On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: >>> Hi, >>> I was replacing some os.path stuff with Pathlib and I discovered this: >

Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Thomas Passin via Python-list wrote: > On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote: >> Hi, >> I was replacing some os.path stuff with Pathlib and I discovered this: >> Path(256 * "x").is_file() # OSError >> os.path.isfile(256 * "x") # bool >> I

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-08 Thread Grant Edwards via Python-list
On 2024-03-08, Chris Angelico via Python-list wrote: > On Sat, 9 Mar 2024 at 00:51, Grant Edwards via Python-list > wrote: > >> One might argue that "global" isn't a good choice for what to call the >> scope in question, since it's not global. It's l

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-08 Thread Grant Edwards via Python-list
It's limited to that source file. It doesn't make sense to me to call a binding "global", when there can be multile different "global" bindings of the same name. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Grant Edwards via Python-list
On 2024-03-07, dn via Python-list wrote: > The idea of importing a module into the REPL and then (repeatedly) > manually entering the code to set-up and execute is unusual (surely type > such into a script (once), and run that (repeatedly). As you say, most > of us would be working from an IDE

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread Grant Edwards via Python-list
On 2024-03-06, Roel Schroeven via Python-list wrote: > Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list: >> >>> from scoping2 import * > > [...] > > I would advice not to use 'import *', if at all possible, for multiple > reasons, one of which is to prevent problems like this. Unfortun

Re: Can u help me?

2024-03-06 Thread Grant Edwards via Python-list
On 2024-03-06, MRAB via Python-list wrote: > On 2024-03-06 01:44, Ethan Furman via Python-list wrote: >> On 3/5/24 16:49, MRAB via Python-list wrote: >> > On 2024-03-06 00:24, Ethan Furman via Python-list wrote: >> >> On 3/5/24 16:06, Chano Fucks via Python-list wrote: >> >> >> >>> [image:

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-05 Thread Grant Edwards via Python-list
On 2024-03-05, Cameron Simpson via Python-list wrote: > Because there are no variable definitions in Python, when you write > a function Python does a static analysis of it to decide which > variables are local and which are not. If there's an assignment to a > variable, it is a local variable.

Re: Problem resizing a window and button placement

2024-02-24 Thread Grant Edwards via Python-list
have to spend a little time learning how they work, but in the end you'll get done sooner and have better results. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Can one output something other than 'nan' for not a number values?

2024-02-19 Thread Grant Edwards via Python-list
On 2024-02-19, Chris Green via Python-list wrote: > It's using f'{...}' at the moment. Here's a demonstration of how to hook custom code into the f-string formatting engine. It's brilliantly depraved. https://stackoverflow.com/questions/55876683/hook-into-the-builtin-python-f-string-format-mach

Re: Testing (sorry)

2024-02-19 Thread Grant Edwards via Python-list
ss that in future I'll wait a couple days before I assume something is broken. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Testing (sorry)

2024-02-18 Thread Grant Edwards via Python-list
On 2024-02-18, Peter J. Holzer via Python-list wrote: > [Replying to the list *and* Grant] > > On 2024-02-17 19:38:04 -0500, Grant Edwards via Python-list wrote: >> Today I noticed that nothing I've posted to python-list in past 3 >> weeks has shown up on the list. >

Testing (sorry)

2024-02-18 Thread Grant Edwards via Python-list
Today I noticed that nothing I've posted to python-list in the past 3 weeks has shown up on the list. I don't know how to troubleshoot this other than by sending test messages. Obviously, if this shows up on the list, then I'm making progress... [message 3] -- Grant -- https://

Testing (sorry)

2024-02-18 Thread Grant Edwards via Python-list
Today I noticed that nothing I've posted to python-list in past 3 weeks has shown up on the list. I don't know how to troubleshoot this other than sending test messages. Obviously, if this shows up on the list, then I'm making progress. [message 4] -- Grant -- https://mail.pyt

Testing - 2 (sorry)

2024-02-18 Thread Grant Edwards via Python-list
Today I noticed that nothing I've posted to python-list in past 3 weeks has shown up on the list. I don't know how to troubleshoot this other than sending test messages. Obviously, if this shows up on the list, then I've gotten it to work... -- Grant -- https://mail.python.org/m

Testing (sorry)

2024-02-18 Thread Grant Edwards via Python-list
Today I noticed that nothing I've posted to python-list in past 3 weeks has shown up on the list. I don't know how to troubleshoot this other than sending test messages. Obviously, if this shows up on the list, then I've gotten it to work... -- Grant -- https://mail.python.org/m

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
7; work. Is float.__format__ what's used by f-strings, the % operator, etc.? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
d decimal places, I doubt str(f) will meet the need. I tried monkey-patching the float type's __format__ method, but it's immutable. Is float.__format__() what's used by f-strings, the '%' operator, etc.? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
#x27;s __format__ method, but it's immutable. Is float.__format__() what's used by f-strings, the '%' operator, etc.? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
return "-" > return str(f) Since he's obviously using one of the float formatting mechanisms to control the number of columsn and decimal places, I doubt str(f) will meet the need. I tried monkey-patching the float type's __format__ method, but it's immutable.

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
return "-" > return str(f) Since he's obviously using one of the float formatting mechanisms to control the number of columsn and decimal places, I doubt str(f) will meet the need. I tried monkey-patching the float type's __format__ method, but it's immutable.

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
27; is going to meet the need. I tried monkey-patching the __format__ method of the 'float' type, but it's immutable -- so that didn't work. Is float.__format__() what's used by f-strings, the % operator, etc.? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
s your code. Except he's obviously using some sort of formatting to control the number of columns and decimal places, so 'str(f)' is not going to cut it. Is the basic floating point number formatting functionality seen when using f-strings or '%' operator part of the float type or is it part of the f-string and % operator? -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread Grant Edwards via Python-list
n used by the various formatting mechanisms, so you might end up scraping bits off the walls... -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-29 Thread Grant Edwards via Python-list
On 2024-01-29, Rich Shepard via Python-list wrote: > On Mon, 29 Jan 2024, Rich Shepard via Python-list wrote: > >> No, I hadn't ... but I am reading it now. > > Perhaps I missed the answer to my question when reading the io module. It > explains how to open/write/read files of text and binary data

Re: How/where to store calibration values - written by program A, read by program B

2023-12-29 Thread Grant Edwards via Python-list
On 2023-12-28, Peter J. Holzer via Python-list wrote: > On 2023-12-28 05:20:07 +, rbowman via Python-list wrote: >> On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote: >> > The biggest caveat is that the shared variable MUST exist before it can >> > be examined or used (not surprising). >>

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Grant Edwards via Python-list
On 2023-12-11, Chris Green via Python-list wrote: > Is there a way to abbreviate the following code somehow? > > lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} > sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'} > la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'} >

Re: Context without manager

2023-11-26 Thread Grant Edwards via Python-list
On 2023-11-27, Grant Edwards via Python-list wrote: > On 2023-11-26, Dieter Maurer via Python-list wrote: > >> If you do not have this case (e.g. usually if you open the file >> in a class's `__init__`), you do not use a context manager. > > He knows that. The OP wro

Re: Context without manager

2023-11-26 Thread Grant Edwards via Python-list
On 2023-11-26, Dieter Maurer via Python-list wrote: > If you do not have this case (e.g. usually if you open the file > in a class's `__init__`), you do not use a context manager. He knows that. The OP wrote that he wants to use that can _only_ be used by a context manager, but he wants that us

Re: xor operator

2023-11-13 Thread Grant Edwards via Python-list
On 2023-11-14, Dom Grigonis via Python-list wrote: > >> Except the 'any' and 'all' builtins are _exactly_ the same as bitwise >> or and and applided to many bits. To do something "in line" with that >> using the 'xor' operator would return True for an odd number of True >> values and False for an

Re: xor operator

2023-11-13 Thread Grant Edwards via Python-list
n line" with that using the 'xor' operator would return True for an odd number of True values and False for an even Number of True values. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-13 Thread Grant Edwards via Python-list
On 2023-11-13, Dom Grigonis via Python-list wrote: > Hi All, > > I think it could be useful to have `xor` builtin, which has API similar to > the one of `any` and `all`. > > * Also, it could have optional second argument `n=1`, which > * indicates how many positives indicates `True` return. For

Re: Checking if email is valid

2023-11-07 Thread Grant Edwards via Python-list
On 2023-11-06, Greg Ewing via Python-list wrote: > On 7/11/23 7:45 am, Mats Wichmann wrote: >> Continuing with the example, if you have a single phone number field, or >> let a mobile number be entered in a field marked for landline, you will >> probably assume you can text to that number. > > B

Re: Checking if email is valid

2023-11-05 Thread Grant Edwards via Python-list
On 2023-11-05, D'Arcy Cain via Python-list wrote: > On 2023-11-05 00:39, Grant Edwards via Python-list wrote: >> Definitely. Syntactic e-mail address "validation" is one of the most >> useless and widely broken things on the Interwebs. People who do >> any

Re: Checking if email is valid

2023-11-04 Thread Grant Edwards via Python-list
of the most useless and widely broken things on the Interwebs. People who do anything other than require an '@' (and optionally make you enter the same @-containing string twice) are deluding themselves. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-03 Thread Grant Edwards via Python-list
and would therefore be "correctly" rejected), but but in practice will work just fine. I've never spent enough time looking at the RFC to even propose test cases for that... -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-01 Thread Grant Edwards via Python-list
On 2023-11-01, Chris Angelico via Python-list wrote: > On Thu, 2 Nov 2023 at 08:09, Grant Edwards via Python-list > wrote: >> Make sure it has an '@' in it. Possibly require at least one '.' >> after the '@'. > > No guarantee that there&#x

Re: Checking if email is valid

2023-11-01 Thread Grant Edwards via Python-list
On 2023-11-01, Simon Connah via Python-list wrote: > I'm building a simple project using smtplib and have a > question. I've been doing unit testing but I'm not sure how to check > if an email message is valid. Send an e-mail using it? If the right person gets the e-mail, then it's valid? > Us

Re: Question(s)

2023-10-25 Thread Grant Edwards via Python-list
On 2023-10-25, o1bigtenor via Python-list wrote: > Haven't heard of a python IDE - - - doesn't mean that there isn't such - - > just that I haven't heard of such. Is there a python IDE? Seriously? Now you're just trolling. google.com/search?q=python+ide&am

Re: Question(s)

2023-10-24 Thread Grant Edwards via Python-list
On 2023-10-24, o1bigtenor via Python-list wrote: > So how does one test software then? That's what customers are for! [Actually, that's true more often than it should be.] -- https://mail.python.org/mailman/listinfo/python-list

Re: Question(s)

2023-10-24 Thread Grant Edwards via Python-list
On 2023-10-24, Thomas Passin via Python-list wrote: > Something less ambitious than a full proof of correctness of an > arbitrary program can sometimes be achieved. The programming team > for the Apollo moon mission developed a system which, if you would > write your requirements in a certain wa

Re: Question(s)

2023-10-24 Thread Grant Edwards via Python-list
On 2023-10-24, Dan Purgert via Python-list wrote: > On 2023-10-24, o1bigtenor wrote: >> Greetings >> >> (Sorry for a nebulous subject but dunno how to have a short title for >> a complex question.) >> [...] >> Is there a way to verify that a program is going to do what it is >> supposed to do even

Re: Question(s)

2023-10-24 Thread Grant Edwards via Python-list
On 2023-10-24, o1bigtenor via Python-list wrote: > Is there a way to verify that a program is going to do what it is > supposed to do even before all the hardware has been assembled and > installed and tested? It depends on what you mean by "verify ...". If you want to prove a program correct (

Re: isinstance()

2023-08-04 Thread Grant Edwards via Python-list
t to the list [65,66,67,68] and sometimes not. Been there, fell in that hole. More than a few times. :/ Famous Last Words: "I wasn't expecting to handle strings -- but I should have been..." -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: What is this TEST BANK stuff ?

2023-06-21 Thread Grant Edwards via Python-list
On 2023-06-21, Chris Angelico via Python-list wrote: > On Thu, 22 Jun 2023 at 02:54, Dan Kolis via Python-list > wrote: >> >> Why do we tolerate this spam ? >> >> this seems most likely a way to inject viruses into people's workflow. >> >> That wiped out usenet. Ahh without an explaination; ( and

Re: Resolution of paths in tracebacks

2023-05-31 Thread Grant Edwards
On 2023-05-31, Vishal Chandratreya wrote: > When an exception occurs, the full path to the file from which it > originates is displayed, but redundant elements are not removed. For > instance: > $ ./python ./foo > Traceback (most recent call last): > File "/home/User/cpython/./foo", line 4, in

Re: Tkinter docs?

2023-05-30 Thread Grant Edwards
On 2023-05-26, Rob Cliffe via Python-list wrote: > Grant, I may well buy one of the books you suggested. I haven't had look at either of the newer books, but I got a lot of good out of the Grayson book (20 years ago). I also had a Tcl/Tk book that I found useful even when usng tkin

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

2023-05-26 Thread Grant Edwards
On 2023-05-26, Grant Edwards wrote: > 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.pyth

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... And

Re: Tkinter docs?

2023-05-23 Thread Grant Edwards
9149564/dp/1999149564/ https://www.amazon.com/Python-GUI-Programming-Tkinter-user-friendly/dp/1801815925/ -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use instead of nntplib?

2023-05-22 Thread Grant Edwards
t again, because the first time they installed pip for the wrong version of python. [I don't really get how that happens, but there seem to be a constant stream of postings from people with that problem.] -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use instead of nntplib?

2023-05-22 Thread Grant Edwards
e now very stable) that lack of "activity" is interpreted as "unpopular" regardless of how many people are using the module. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Tkinter (related)~

2023-05-18 Thread Grant Edwards
nstall something, I always do a --dry-run first and make a note of any dependancies that pip is going to try to install -- so I can install those using the package manager if possible. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Learning tkinter

2023-05-18 Thread Grant Edwards
On 2023-05-12, Rob Cliffe via Python-list wrote: > > Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 > bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import tkinter > >>> tkinter.messagebox > Traceback (most recent cal

Re: What to use instead of nntplib?

2023-05-16 Thread Grant Edwards
On 2023-05-16, Chris Green wrote: > Grizzy Adams wrote: >> Tuesday, May 16, 2023 at 9:26, Alan Gauld wrote: >> Re: What to use instead of nntplib? (at least in part) >> >> >On 15/05/2023 22:11, Grant Edwards wrote: >> >> I got a nice warnin

Re: What to use instead of nntplib?

2023-05-16 Thread Grant Edwards
ted out to me that Perl still has a supported NNTP library. That stung. However, it's a CPAN module, which is more equivalent to PyPI than to the standard library, so I guess that it isn't as bad a loss of face as I feared. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >