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

2024-05-19 Thread Grant Edwards via Python-list
On 2024-05-19, Barry via Python-list wrote: > > >> On 18 May 2024, at 16:27, Peter J. Holzer via Python-list >> wrote: >> >> I don't think Linux users have to deal with venvs > > Modern debian (ubuntu) and fedora block users installing using pip. You can't even use pip to do "user" installs?

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

2024-05-19 Thread Grant Edwards via Python-list
On 2024-05-19, Gilmeh Serda via Python-list wrote: > On Sun, 19 May 2024 08:32:46 +0100, Alan Gauld wrote: > >> I've honestly never experienced this "nightmare". >> I install stuff and it just works. > > Hear! Hear! Me too! And all that. > > I'm on Manjaro, which is a tad finicky about other

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

2024-05-19 Thread Grant Edwards via Python-list
On 2024-05-19, Alan Gauld via Python-list wrote: >> The dependency nightmare created by python, pip >> and all the rest cannot be resolved otherwise. > > I've honestly never experienced this "nightmare". > I install stuff and it just works. Same here. I occasonlly use pip to install something

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

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

2024-05-18 Thread Grant Edwards via Python-list
On 2024-05-18, Peter J. Holzer via Python-list wrote: > On 2024-05-16 19:46:07 +0100, Gordinator via Python-list wrote: > >> To be fair, the problem is the fact that they use Windows (but I >> guess Linux users have to deal with venvs, so we're even. > > I don't think Linux users have to deal

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

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

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
On 2024-04-10, Alan Gauld via Python-list wrote: > On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote: > >> I have a simple question. I use the following textPrompt in some of my >> Jython modules: >> '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, >>

Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
On 2024-04-10, WordWeaver Evangelist via Python-list wrote: > I have a simple question. I use the following textPrompt in some of my Jython > modules: > '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, > forceUppercase=True) > Is there a way to add an ANSI color code

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-value pair. >> >> It does. > > Indeed,

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 =

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"

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

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 limited to that

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-07, Cameron Simpson via Python-list wrote: > Yes. Note that the "global" namespace is the module in which the > function is defined. 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 limited to that source file. It

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

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.

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: >> >> >> >>>

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
On 2024-02-24, MRAB via Python-list wrote: > On 2024-02-24 01:14, Steve GS via Python-list wrote: > >> Python, Tkinter: How do I determine if a window has been resized? I >> want to locate buttons vertically along the right border and need >> to know the new width. The buttons are to move with

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.

Re: Testing (sorry)

2024-02-19 Thread Grant Edwards via Python-list
On 2024-02-19, Thomas Passin wrote: >> About 24 hours later, all of my posts (and the confirmation e-mails) >> all showed up in a burst at the same time on two different unrelated >> e-mail accounts. >> >> I still have no clue what was going on... > > Sometimes a post of mine will not show up

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

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

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

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

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

2024-02-18 Thread Grant Edwards via Python-list
On 2024-02-16, Chris Green wrote: > I'm looking for a simple way to make NaN values output as something > like '-' or even just a space instead of the string 'nan'. I tried monkey-patching the __format__ method of float, but it's immutable, so that didnt' work. Is float.__format__ what's used

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

2024-02-18 Thread Grant Edwards via Python-list
[I've been trying all afternoon to post via slrn, but nothing is showing up on the list. Forgive me if multiple posts eventually show up.] On 2024-02-17, Cameron Simpson via Python-list wrote: > On 16Feb2024 22:12, Chris Green wrote: >>I'm looking for a simple way to make NaN values output as

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

2024-02-18 Thread Grant Edwards via Python-list
[Posts via slrn and my GMail account aren't showing up, so I guess I'll try subscribing from a different e-mail address.] On 2024-02-17, Cameron Simpson via Python-list wrote: On 16Feb2024 22:12, Chris Green wrote: I'm looking for a simple way to make NaN values output as something like

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

2024-02-18 Thread Grant Edwards via Python-list
On 2024-02-17, Cameron Simpson via Python-list wrote: > On 16Feb2024 22:12, Chris Green wrote: >>I'm looking for a simple way to make NaN values output as something >>like '-' or even just a space instead of the string 'nan'. [...] >> >>Battery Voltages and Currents >>Leisure Battery -

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

2024-02-18 Thread Grant Edwards via Python-list
On 2024-02-17, Cameron Simpson via Python-list wrote: > On 16Feb2024 22:12, Chris Green wrote: >>I'm looking for a simple way to make NaN values output as something >>like '-' or even just a space instead of the string 'nan'. [...] >> >>Battery Voltages and Currents >>Leisure Battery -

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

2024-02-18 Thread Grant Edwards via Python-list
On 2024-02-17, Cameron Simpson via Python-list wrote: > On 16Feb2024 22:12, Chris Green wrote: >>I'm looking for a simple way to make NaN values output as something >>like '-' or even just a space instead of the string 'nan'. [...] >> >>Battery Voltages and Currents >>Leisure Battery -

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

2024-02-18 Thread Grant Edwards via Python-list
On 2024-02-17, Cameron Simpson via Python-list wrote: > On 16Feb2024 22:12, Chris Green wrote: >>I'm looking for a simple way to make NaN values output as something >>like '-' or even just a space instead of the string 'nan'. >>[...] >> >>Battery Voltages and Currents >>Leisure Battery -

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

2024-02-18 Thread Grant Edwards via Python-list
On 2024-02-16, Chris Green via Python-list wrote: > I'm looking for a simple way to make NaN values output as something > like '-' or even just a space instead of the string 'nan'. It would probably help if you told us how you're "outputting" them now (the Python feaatures/functions used, not

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

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 wr

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

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
On 2023-11-13, Dom Grigonis via Python-list wrote: > I am not asking. Just inquiring if the function that I described > could be useful for more people. > > Which is: a function with API that of `all` and `any` and returns > `True` if specified number of elements is True. I've got no objection

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

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 >&

Re: Checking if email is valid

2023-11-04 Thread Grant Edwards via Python-list
On 2023-11-04, Michael Torrie via Python-list wrote: > On 11/4/23 02:51, Simon Connah via Python-list wrote: > >> Wow. I'm half tempted to make a weird email address to see how many >> websites get it wrong. In my experience, they don't have to be very weird at all. >> Thank you for the link. >

Re: Checking if email is valid

2023-11-03 Thread Grant Edwards via Python-list
On 2023-11-02, Michael Torrie via Python-list wrote: > On 11/2/23 00:42, Simon Connah via Python-list wrote: > >> Valid as in conforms to the standard. Although having looked at the >> standard that might be more difficult than originally planned. > > You'll have to read the relevant RFCs. Lots

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'll be a dot after the at. Ah, I

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? >

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=python+ide -- Grant --

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

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

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
On 2023-08-04, Chris Angelico via Python-list wrote: > On Sat, 5 Aug 2023 at 09:36, dn via Python-list > wrote: > >> Faced with a situation where an argument may be a scalar-value or an >> iterable, I'll presume the latter, eg throw it straight into a for-loop. >> If that fails (because the

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