Re: Why no list as dict key?

2022-04-20 Thread 2QdxY4RzWzUUiLuE
On 2022-04-21 at 06:22:53 +0400, Abdur-Rahmaan Janhangeer wrote: > Maybe hashes should point to an object rather than being the hash of an > object themselves. > Maybe the speed drop is not worth it. Then you have a different problem. x = [1, 2, 3] y = [n for n in 1, 2, 3] Those two li

Re: Style for docstring

2022-04-22 Thread 2QdxY4RzWzUUiLuE
On 2022-04-22 at 15:35:15 -0500, "Michael F. Stemper" wrote: > On 22/04/2022 14.59, Chris Angelico wrote: > > On Sat, 23 Apr 2022 at 05:56, Michael F. Stemper > > wrote: > > > > > > I'm writing a function that is nearly self-documenting by its name, > > > but still want to give it a docstring.

Re: Style for docstring

2022-04-22 Thread 2QdxY4RzWzUUiLuE
On 2022-04-23 at 08:33:37 +1000, Chris Angelico wrote: > On Sat, 23 Apr 2022 at 08:24, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2022-04-22 at 15:35:15 -0500, > > "Michael F. Stemper" wrote: > > > > > On 22/04/2022 14.59, Chris Angelico wrote: > > > > On Sat, 23 Apr 2022 at 05:56, M

Re: Python/New/Learn

2022-05-06 Thread 2QdxY4RzWzUUiLuE
On 2022-05-05 at 16:51:49 -0700, Grant Edwards wrote: > On 2022-05-05, Mats Wichmann wrote: > > > Without having any data at all on it, just my impressions, more > > people these days learn from in-person or video experiences. > > I've always been utterly baffled by video tutorials for > progr

Re: tail

2022-05-09 Thread 2QdxY4RzWzUUiLuE
On 2022-05-08 at 18:52:42 +, Stefan Ram wrote: > Remember how recently people here talked about how you cannot copy > text from a video? Then, how did I do it? Turns out, for my > operating system, there's a screen OCR program! So I did this OCR > and then manually corrected a few wro

Re: Changing calling sequence

2022-05-11 Thread 2QdxY4RzWzUUiLuE
On 2022-05-11 at 08:33:27 -0500, "Michael F. Stemper" wrote: > I have a function that I use to retrieve daily data from a > home-brew database. Its calling sequence is; > > def TempsOneDay( year, month, date ): > > After using it (and its friends) for a few years, I've come to > realize that th

Re: tail

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

Re: Changing calling sequence

2022-05-14 Thread 2QdxY4RzWzUUiLuE
On 2022-05-15 at 10:22:15 +1200, dn wrote: > That said, a function which starts with a list of ifs-buts-and-maybes* > which are only there to ascertain which set of arguments have been > provided by the calling-routine; obscures the purpose/responsibility > of the function and decreases its reada

Re: Changing calling sequence

2022-05-15 Thread 2QdxY4RzWzUUiLuE
On 2022-05-15 at 14:44:09 +1000, Chris Angelico wrote: > On Sun, 15 May 2022 at 14:27, dn wrote: > > > > On 15/05/2022 11.34, 2qdxy4rzwzuui...@potatochowder.com wrote: > > > On 2022-05-15 at 10:22:15 +1200, > > > dn wrote: > > > > > >> That said, a function which starts with a list of ifs-buts-

Re: How to test characters of a string

2022-06-07 Thread 2QdxY4RzWzUUiLuE
On 2022-06-07 at 21:35:43 +0200, Dave wrote: > I’m new to Python and have a simple problem that I can’t seem to find > the answer. > I want to test the first two characters of a string to check if the > are numeric (00 to 99) and if so remove the fist three chars from the > string. > Example: i

Re: How to test characters of a string

2022-06-07 Thread 2QdxY4RzWzUUiLuE
On 2022-06-08 at 07:29:03 +1000, Chris Angelico wrote: > On Wed, 8 Jun 2022 at 07:24, Barry wrote: > > > > > > > > > On 7 Jun 2022, at 22:04, Dave wrote: > > > > > > It depends on the language I’m using, in Objective C, I’d use isNumeric, > > > just wanted to know what the equivalent is in Py

Re: How to test characters of a string

2022-06-07 Thread 2QdxY4RzWzUUiLuE
On 2022-06-07 at 23:07:42 +0100, Regarding "Re: How to test characters of a string," MRAB wrote: > On 2022-06-07 21:23, Dave wrote: > > Thanks a lot for this! isDigit was the method I was looking for and > > couldn’t find. > > > > I have another problem related to this, the following code uses

Re: How to test characters of a string

2022-06-08 Thread 2QdxY4RzWzUUiLuE
On 2022-06-08 at 08:07:40 -, De ongekruisigde wrote: > Depending on the problem a regular expression may be the much simpler > solution. I love them for e.g. text parsing and use them all the time. > Unrivaled when e.g. parts of text have to be extracted, e.g. from lines > like these: > >

Re: How to test characters of a string

2022-06-08 Thread 2QdxY4RzWzUUiLuE
On 2022-06-09 at 03:18:56 +1000, Chris Angelico wrote: > On Thu, 9 Jun 2022 at 03:15, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2022-06-08 at 08:07:40 -, > > De ongekruisigde wrote: > > > > > Depending on the problem a regular expression may be the much simpler > > > solution. I

Re: How to test characters of a string

2022-06-08 Thread 2QdxY4RzWzUUiLuE
On 2022-06-09 at 04:15:46 +1000, Chris Angelico wrote: > On Thu, 9 Jun 2022 at 04:14, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2022-06-09 at 03:18:56 +1000, > > Chris Angelico wrote: > > > > > On Thu, 9 Jun 2022 at 03:15, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > > > > >

Re: ModuleNotFoundError

2022-06-17 Thread 2QdxY4RzWzUUiLuE
On 2022-06-17 at 08:03:28 +, Zoltan Szenderak wrote: > How do I reply to: Chris Angelico rosuav at gmail.com so it is listed > on the Python list? Please don't. Please continue replying to python-list@python.org; that way, other people can help you, and future programmers can find their iss

Re: "CPython"

2022-06-21 Thread 2QdxY4RzWzUUiLuE
On 2022-06-21 at 17:04:45 +, Avi Gross via Python-list wrote: > My problem with that idea is, believe it or not, that it is too negative. > What you meant to be seen as a dash is a minus sign to me. And both C and C++ > not only have both a pre and post autoincrement variable using ++x and

Re: calculate diff between dates

2022-07-12 Thread 2QdxY4RzWzUUiLuE
On 2022-07-12 at 15:37:55 +0300, נתי שטרן wrote: > I glad for any help http://www.sscce.org/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Object in List : how?

2022-07-24 Thread 2QdxY4RzWzUUiLuE
On 2022-07-24 at 19:47:38 -0500, Khairil Sitanggang wrote: > Regarding [Peter Otten's] comment : " > *However, usually object creation and initialization iscombined by allowing > arguments to the initializer:*" , so which one of the two classes Node1, > Node2 below is more common in practice? Opt

Re: More efficient code, but slower program

2022-07-27 Thread 2QdxY4RzWzUUiLuE
On 2022-07-27 at 17:48:47 +0200, Regarding "Re: More efficient code, but slower program," Cecil Westerhof via Python-list wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > > > Cecil Westerhof writes: > >>values = [*range(100)] > > > > In many cases, any iterable is just fine and a list

Re: mailbox misbehavior with non-ASCII

2022-07-29 Thread 2QdxY4RzWzUUiLuE
On 2022-07-29 at 23:24:57 +, Peter Pearson wrote: > The following code produces a nonsense result with the input > described below: > > import mailbox > box = mailbox.Maildir("/home/peter/Temp/temp",create=False) > x = box.values()[0] > h = x.get("X-DSPAM-Factors") > print(type(h)) > # >

Re: Tkinter not working

2022-08-01 Thread 2QdxY4RzWzUUiLuE
On 2022-08-01 at 18:53:47 +0100, Matthew Barnett wrote: > On 01/08/2022 13:17, Daniel Lee wrote: > > Hello, I my code with tkinter was working before, and now, it has many > > errors in it. I’m not sure what has happened. The results after running are > > below: > > > > "D:\Python Projects\tes

Re: Dictionary order?

2022-08-01 Thread 2QdxY4RzWzUUiLuE
On 2022-08-01 at 13:41:11 -0700, Dan Stromberg wrote: > keys = [5, 10, 15, 14, 9, 4, 1, 2, 8, 6, 7, 12, 11] > > dict_ = {} > for key in keys: > dict_[key] = 1 $ python Python 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0] on linux Type "help", "copyright", "credits" or "license" for more

Re: Dictionary order?

2022-08-01 Thread 2QdxY4RzWzUUiLuE
On 2022-08-02 at 07:50:52 +1000, Chris Angelico wrote: > On Tue, 2 Aug 2022 at 07:48, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2022-08-01 at 13:41:11 -0700, > > Dan Stromberg wrote: > > > > > keys = [5, 10, 15, 14, 9, 4, 1, 2, 8, 6, 7, 12, 11] > > > > > > dict_ = {} > > > for key i

Re: Register multiple excepthooks?

2022-08-04 Thread 2QdxY4RzWzUUiLuE
On 2022-08-04 at 09:41:00 +0200, Albert-Jan Roskam wrote: >Thank you both. I'll give this a try. I think it would be nice if >the standard library function atexit.register would be improved, >such that the registered functions would not only be called upon >(a) normal program term

Re: Parallel(?) programming with python

2022-08-10 Thread 2QdxY4RzWzUUiLuE
On 2022-08-09 at 17:04:51 +, "Schachner, Joseph (US)" wrote: > Why would this application *require* parallel programming? This could > be done in one, single thread program. Call time to get time and save > it as start_time. Keep a count of the number of 6 hour intervals, > initialize it t

Re: Mutating an HTML file with BeautifulSoup

2022-08-19 Thread 2QdxY4RzWzUUiLuE
On 2022-08-19 at 20:12:35 +0100, Barry wrote: > > On 19 Aug 2022, at 19:33, Chris Angelico wrote: > > > > What's the best way to precisely reconstruct an HTML file after > > parsing it with BeautifulSoup? > > I recall that in bs4 it parses into an object tree and loses the > detail of the inp

Re: How to replace an instance method?

2022-09-19 Thread 2QdxY4RzWzUUiLuE
On 2022-09-18 at 09:11:28 +, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): > >types.MethodType( function, instance ) > >functools.partial( function, instance ) > >new_method.__get__( instance ) > > I wonder which of these three possibilities expresses > t

Re: Changing 'Scripts/*.exe'

2022-10-04 Thread 2QdxY4RzWzUUiLuE
On 2022-10-04 at 14:55:36 +1300, dn wrote: > On 04/10/2022 14.10, Meredith Montgomery wrote: > > r...@zedat.fu-berlin.de (Stefan Ram) writes: > > > >> Meredith Montgomery writes: > >>> Wouldn't it be great if it were portable by default? > >> > >> I think under Windows there is a division of

Re: Find the path of a shell command

2022-10-12 Thread 2QdxY4RzWzUUiLuE
On 2022-10-12 at 17:43:18 +0100, Paulo da Silva wrote: > Às 17:22 de 12/10/22, Tilmann Hentze escreveu: > > Paulo da Silva schrieb: > > > I have python program that launches a detached rm. It works pretty well > > > until it is invoked by cron! I suspect that for cron we need to specify > > > th

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread 2QdxY4RzWzUUiLuE
On 2022-11-07 at 11:56:19 +, "Weatherby,Gerard" wrote: > Write the wrapper script. > > #!/bin/bash > if [ $(hostname) == "oldystem" ]; then > exec /usr/bin/python $* > else > exec /usr/bin/python2 $* > fi Use "$@" (with the quotes) instead of a bare $*. The former preserves quoted

Re: Need max values in list of tuples, based on position

2022-11-12 Thread 2QdxY4RzWzUUiLuE
On 2022-11-12 at 15:03:10 +, "Weatherby,Gerard" wrote: > Types are available if you want to use > them. https://www.pythontutorial.net/python-basics/python-type-hints/ Python has always been a strongly typed language. Recent changes have given it some level of static type checking in additi

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread 2QdxY4RzWzUUiLuE
On 2023-01-03 at 21:24:20 +, c.bu...@posteo.jp wrote: > The main question here is why does Python deciecded to make all logs > go to stderr? It makes sense to send all logging to one destination, and stderr is that place. > Maybe I totally misunderstood the intention of logging.info()?! Isn'

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread 2QdxY4RzWzUUiLuE
On 2023-01-04 at 12:02:55 +, "Weatherby,Gerard" wrote: > Dealing with stdout / stderr is bash is just syntax. I don’t always > remember it off the top of my head but … stackoverflow.com. https://tldp.org/LDP/abs/html/io-redirection.html > On Linux at least it’s possible to pipe to arbitrary

Re: Improvement to imports, what is a better way ?

2023-01-19 Thread 2QdxY4RzWzUUiLuE
On 2023-01-19 at 12:59:21 -0500, Thomas Passin wrote: > Well, it's an art, not a science [...] +1 > # Create a plot > g2 = ( > ggplot(df2, > aes('Days Since Jan 22', # Comments can clarify these params > + geom_point(size=.1, color='blue') # size, color params optional >

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

2023-01-23 Thread 2QdxY4RzWzUUiLuE
On 2023-01-22 at 18:19:13 -0800, Jach Feng wrote: > 1) Modify the sys.argv by inserting an item '--' before parsing it, ie. > sys.argv.insert(1, '--') > args = parser.parse_args() Please don't do that. :-) In my mind, sys.argv belongs to Python, not the application. Instead, pass a newly crea

Re: bool and int

2023-01-24 Thread 2QdxY4RzWzUUiLuE
On 2023-01-25 at 08:58:06 +1100, Chris Angelico wrote: > On Wed, 25 Jan 2023 at 08:22, MRAB wrote: > > For backwards compatibility, bool was made a subclass of int. > > Plus, it's really REALLY handy in quite a lot of situations. > > > > C# is pickier, which I guess is a good thing. > > > > N

Re: bool and int

2023-01-25 Thread 2QdxY4RzWzUUiLuE
On 2023-01-25 at 12:14:50 +1100, Chris Angelico wrote: > On Wed, 25 Jan 2023 at 10:32, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > The usual complaint is that some people write FORTRAN no matter what > > language they're actually using. Are you writing Python in C#? ;-) > But the way I ha

Re: bool and int

2023-01-25 Thread 2QdxY4RzWzUUiLuE
On 2023-01-25 at 23:11:37 +1100, Chris Angelico wrote: > On Wed, 25 Jan 2023 at 22:55, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > So, I think what you're trying to say is that you prefer the razor sharp > > quality of truthiness to the zen of explicit being better than implicit. > > Not su

Flamebait (was: Re: bool and int)

2023-01-26 Thread 2QdxY4RzWzUUiLuE
On 2023-01-26 at 10:52:06 +, "Weatherby,Gerard" wrote: > I can’t help but wonder if there exists some Java forum /mailing list > going on about how horrible Python is. Not some of them. *All* of them. Here's the summary: - Dynamic Typing causes defects and makes non-toy software project

Re: bool and int

2023-01-26 Thread 2QdxY4RzWzUUiLuE
On 2023-01-26 at 12:12:30 -0500, Dino wrote: > On 1/25/2023 5:42 PM, Chris Angelico wrote: > > > > > Try this (or its equivalent) in as many languages as possible: > > > > x = (1 > 2) > > x == 0 > > > > You'll find that x (which has effectively been set to False, or its > > equivalent in any

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

2023-01-29 Thread 2QdxY4RzWzUUiLuE
On 2023-01-29 at 16:51:20 +1100, Cameron Simpson wrote: > They're unrelated. As others have mentioned, "--" is _extremely_ common; > almost _all_ UNIX command like programmes which handle -* style options > honour the "--" convention. _argparse_ itself honours that convention, as > does getopt et

Re: Organizing modules and their code

2023-02-03 Thread 2QdxY4RzWzUUiLuE
On 2023-02-03 at 13:18:46 -0800, transreductionist wrote: > Here is the situation. There is a top-level module (see designs below) > containing code, that as the name suggests, manages an ETL pipeline. A > directory is created called etl_helpers that organizes several modules > responsible for ma

Re: How to read file content and send email on Debian Bullseye

2023-02-04 Thread 2QdxY4RzWzUUiLuE
On 2023-02-04 at 17:59:11 -0500, Thomas Passin wrote: > On 2/4/2023 10:05 AM, ^Bart wrote: > > Hi guys, > > > > On a Debian Bullseye server I have a lftp upload and after it I should > > send an email. [...] > [...] you could run a shell script that sends the file with lftp, and > depending on

Re: Evaluate once or every time

2023-02-24 Thread 2QdxY4RzWzUUiLuE
On 2023-02-24 at 18:42:39 -0500, Thomas Passin wrote: > VOWELS = 'aeiouAEIOU' > is_vowel = 'y' in VOWELS > > If I really needed them to be in a list, I'd probably do a list > comprehension: > > VOWEL_LIST = [ch for ch in VOWELS] Why use a comprehension when a simple loop will do? ;-) No. Wa

Re: No module named _socket, on windows

2023-02-26 Thread 2QdxY4RzWzUUiLuE
On 2023-02-25 at 15:58:35 -0800, ofek shulberg wrote: > On Monday, January 4, 2010 at 9:19:21 PM UTC+2, Gabriel Genellina wrote: > > En Mon, 04 Jan 2010 14:24:22 -0300, louisJ escribi�: > > > I installed python 2.6 (from python.org) for windows XP, and then > > > Pylab. > > > When I type "import

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread 2QdxY4RzWzUUiLuE
On 2023-03-01 at 14:35:35 -0500, avi.e.gr...@gmail.com wrote: > What would have happened if all processors had been required to have > some low level instruction that effectively did something in an atomic > way that allowed a way for anyone using any language running on that > machine a way to do

Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread 2QdxY4RzWzUUiLuE
On 2023-03-02 at 11:25:49 +, Stephen Tucker wrote: > The range function in Python 2.7 (and yes, I know that it is now > superseded), provokes a Memory Error when asked to deiliver a very long > list of values. > > I assume that this is because the function produces a list which it then > ite

Re: Regular Expression bug?

2023-03-02 Thread 2QdxY4RzWzUUiLuE
On 2023-03-02 at 14:22:41 -0500, jose isaias cabrera wrote: > For the RegExp Gurus, consider the following python3 code: > > import re > s = "pn=align upgrade sd=2023-02-" > ro = re.compile(r"pn=(.+) ") > r0=ro.match(s) > >>> print(r0.group(1)) > align upgrade > > > This is wrong. It should be

Re: Baffled by readline module

2023-03-09 Thread 2QdxY4RzWzUUiLuE
On 2023-03-09 at 15:02:53 -0800, Grant Edwards wrote: > Yeesh. What's _really_ embarassing is that I just stumbled across a > small test program with which I had apparently figured this out 10-12 > years ago. Must be about time to retire... Retiring doesn't help. :-) I retired almost five yea

Re: Baffled by readline module

2023-03-09 Thread 2QdxY4RzWzUUiLuE
On 2023-03-10 at 11:02:52 +1100, Chris Angelico wrote: > Traditional retirement: Work till you're 60 or 65 or whatever, then > society pats you on the head, calls you a "senior citizen", and lets > you go and be idle till you die (which might be prematurely soon). Sounds like Free Four¹: The

Re: Baffled by readline module

2023-03-09 Thread 2QdxY4RzWzUUiLuE
On 2023-03-10 at 12:57:48 +1100, Chris Angelico wrote: > On Fri, 10 Mar 2023 at 12:56, Greg Ewing via Python-list > wrote: > > > > On 10/03/23 1:46 pm, Grant Edwards wrote: > > > That's not how it acts for me. I have to "import readline" to get > > > command line recall and editing. > > > > Mayb

Re: Baffled by readline module

2023-03-09 Thread 2QdxY4RzWzUUiLuE
On 2023-03-09 at 19:11:56 -0800, Grant Edwards wrote: > On 2023-03-10, 2qdxy4rzwzuui...@potatochowder.com > <2qdxy4rzwzuui...@potatochowder.com> wrote: > If you run this application from the command line, you get command > recall and editing when entering strings at the "cmd:" prompt? > > #!/u

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread 2QdxY4RzWzUUiLuE
On 2023-03-10 at 22:16:05 -0500, Thomas Passin wrote: > I'd make the pattern in this example even more understandable and less > error-prone: > > def update_pids(target): > cmd = ["tail", "-n", "1", "-f", f"/var/log/{target}"] > pids.update({target: subprocess.Popen(cmd)}) if not \ >

Re: Friday finking: IDE 'macro expansions'

2023-03-16 Thread 2QdxY4RzWzUUiLuE
On 2023-03-17 at 11:55:38 +1300, dn via Python-list wrote: > Do you make use of your IDE's expansionist tendencies, and if-so, which > ones? Expansionist tendencies. Nice phrase. :-) > NB this is where vi/emacs enthusiasts start chuckling (polite term for > 'insane cackling') ... Long time (

Re: Friday finking: IDE 'macro expansions'

2023-03-18 Thread 2QdxY4RzWzUUiLuE
On 2023-03-18 at 11:49:24 +, "Weatherby,Gerard" wrote: > For templating, I have two Python programs for starting new work. One > generates a standalone Python program with the Python shebang, a > __main__ which calls def main(), and logging and argparser > intialization. The other generates a

Re: What kind of "thread safe" are deque's actually?

2023-03-27 Thread 2QdxY4RzWzUUiLuE
On 2023-03-27 at 18:25:01 -0700, Travis Griggs wrote: > "Deques support thread-safe, memory efficient appends and pops from > either side of the deque with approximately the same O(1) performance > in either direction.” > (https://docs.python.org/3.11/library/collections.html?highlight=deque#col

Re: Windows installer from python source code without access to source code

2023-03-31 Thread 2QdxY4RzWzUUiLuE
On 2023-04-01 at 10:49:18 +1100, Chris Angelico wrote: > [...] I don't have access to the Gmail source code but I'm using the > service [...] You have access to Gmail's front end source code. Your web browser runs it every time you use the service (and probably while you aren't using the servic

Re: built-in pow() vs. math.pow()

2023-04-03 Thread 2QdxY4RzWzUUiLuE
On 2023-04-01 at 08:16:46 -0700, Andreas Eisele wrote: > BTW, there is another difference: built-in pow() deals with complex > arguments, while functions in math won't accept them at all. See also . -- https://mail.python.org/mailman/listinfo/python

Re: Weak Type Ability for Python

2023-04-12 Thread 2QdxY4RzWzUUiLuE
On 2023-04-12 at 14:51:44 -0400, Thomas Passin wrote: > On 4/12/2023 1:11 PM, Chris Angelico wrote: > > On Thu, 13 Apr 2023 at 03:05, Ali Mohseni Roodbari > > wrote: > > > > > > Hi all, > > > Please make this command for Python (if possible): > > > > > > > > > x=1 > > > > > > y='a' > > > > > >

Re: Weak Type Ability for Python

2023-04-13 Thread 2QdxY4RzWzUUiLuE
On 2023-04-12 at 22:47:17 -0400, Dennis Lee Bieber wrote: > REXX -- where everything is considered a string until it needs to be > something else. I see your REXX, and raise you an awk,¹ except that awk won't add a string to a number, or a number to string, but it will concatenate in both

Re: RE: Weak Type Ability for Python

2023-04-13 Thread 2QdxY4RzWzUUiLuE
On 2023-04-13 at 22:14:25 -0400, avi.e.gr...@gmail.com wrote: > I am looking at a data structure that is an object of some class and > stores the data in any way that it feels like. But it may be a bit of > a chameleon that shows one face or another as needed. I can write code > now that simply ad

Re: Editing PEP-8, in particular "expected 2 blanks, found 1

2023-05-02 Thread 2QdxY4RzWzUUiLuE
On 2023-05-02 at 20:39:35 +, "Kevin M. Wilson via Python-list" wrote: > [...] Where can I edit these out of my IDE? I doubt anyone will know unless you at least tell us which IDE you're using. -- https://mail.python.org/mailman/listinfo/python-list

Re: Addition of a .= operator

2023-05-20 Thread 2QdxY4RzWzUUiLuE
On 2023-05-21 at 06:11:02 +1200, dn via Python-list wrote: > On 21/05/2023 05.54, Alex Jando wrote: > > I have many times had situations where I had a variable of a certain type, > > all I cared about it was one of it's methods. > > > > For example: > > > >

Re: Application window geometry specifier

2021-01-13 Thread 2QdxY4RzWzUUiLuE
On 2021-01-13 at 21:41:26 -0600, Python wrote: > On Thu, Jan 14, 2021 at 12:27:19PM +1100, Chris Angelico wrote: > > On Thu, Jan 14, 2021 at 12:11 PM Python wrote: > > > > > > On Tue, Jan 12, 2021 at 06:43:39PM -, Grant Edwards wrote: > > > > And those X11 users will swear at you if you over

Re: why sqrt is not a built-in function?

2021-01-14 Thread 2QdxY4RzWzUUiLuE
On 2021-01-14 at 17:54:55 +, Alan Gauld via Python-list wrote: > My question is: why do we even have a sqrt() in the > math module given that pow() and ** are already there? Probably because the standard C math library has such a function, and Python's math module is (or at least was) suppos

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread 2QdxY4RzWzUUiLuE
On 2021-01-16 at 15:42:44 -0500, DonK wrote: > Yes, Windows. Iterating open windows with the Window's API is easy the > hard (very hard) part is sending keystrokes to those windows to Save > them. It's very tricky because the timing is critical. > > You have to use one of those "spy" utilities

Re: A beginning beginner's question about input, output and . . .

2021-01-16 Thread 2QdxY4RzWzUUiLuE
On 2021-01-16 at 17:46:13 -0500, DonK wrote: > On Sat, 16 Jan 2021 14:56:37 -0600, 2qdxy4rzwzuui...@potatochowder.com > wrote: > > >On 2021-01-16 at 15:42:44 -0500, > >DonK wrote: > >> For example, I've found a need to parse text documents quite a number > >> of times over the years. Basic/VB

Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-27 Thread 2QdxY4RzWzUUiLuE
On 2021-01-27 at 17:41:52 -0500, C W wrote: > Great tutorial Irv, very simple with if-else example, gets the point > across. Disclaimer: I did not watch the video. > My main takeaway from the discussion so far is that: you can't > troubleshoot Python without some kind of breakpoint or debugger

Re: I need some help interpreting this error

2021-02-17 Thread 2QdxY4RzWzUUiLuE
On 2021-02-17 at 15:40:27 +, Chris Green wrote: > I'm running this using Python 3.7 on a Linux system. > > Most of the time (i.e. for a couple of days now) the program has been > satifactorily delivering mail messages, hundreds of them. However one > mail message has provoked the following

Re: I need some help interpreting this error

2021-02-17 Thread 2QdxY4RzWzUUiLuE
On 2021-02-17 at 16:42:03 +, Chris Green wrote: > 2qdxy4rzwzuui...@potatochowder.com wrote: > > On 2021-02-17 at 15:40:27 +, > > Chris Green wrote: > > > > > I'm running this using Python 3.7 on a Linux system. > > > > > > Most of the time (i.e. for a couple of days now) the program ha

Re: I need some help interpreting this error

2021-02-17 Thread 2QdxY4RzWzUUiLuE
On 2021-02-17 at 16:52:55 +, Chris Green wrote: > Stefan Ram wrote: > > Chris Green writes: > > >But msghdr["subject"] is surely just a string isn't it? Why is it > > >complaining about something of type 'Header'? > > > > What would you do to debug-print the type of an object? > > > I

Re: I need some help interpreting this error

2021-02-17 Thread 2QdxY4RzWzUUiLuE
On 2021-02-17 at 17:36:48 +, Chris Green wrote: > Stefan Ram wrote: > > Chris Green writes: > > >chris@cheddar$ tail mail.err > > >Traceback (most recent call last): > > > File "/home/chris/.mutt/bin/filter.py", line 95, in > > >if sbstrip in msghdr["subject"]: > > >

Re: Is there a way to subtract 3 from every digit of a number?

2021-02-20 Thread 2QdxY4RzWzUUiLuE
On 2021-02-20 at 09:40:48 -0500, C W wrote: > Hello everyone, > > I'm curious if there is a way take number and back each digit by 3 ? > > 2342 becomes 9019 > 8475 becomes 5142 > 5873 becomes 2540 > > The tricky part is that 2 becomes 9, not -1. > > Here's my toy example and what I attempted,

Re: Is there a way to subtract 3 from every digit of a number?

2021-02-20 Thread 2QdxY4RzWzUUiLuE
On 2021-02-20 at 20:49:15 -0800, Dan Stromberg wrote: > On Sat, Feb 20, 2021 at 7:13 PM Ming wrote: > > > I just wrote a very short code can fulfill your needs: > > > > a = 2342 > > b = int("".join(map(lambda x: str((int(x)-3)%10) ,list(str(a) > > > I tend to favor plenty of temporary varia

Re: Is there a way to subtract 3 from every digit of a number?

2021-02-21 Thread 2QdxY4RzWzUUiLuE
On 2021-02-21 at 09:28:39 -0500, C W wrote: > I got it to work! I defined a separate function, and put it into > df['col_1'].apply(). > > Not the most elegant, but it worked. I'm also curious how people on this > mailing list would do it. I don't know anything about pandas, but for one string o

Re: XML RPC changes between 3.7 and 3.9 yield 401 http error

2021-02-24 Thread 2QdxY4RzWzUUiLuE
On 2021-02-24 at 15:29:58 +0100, lucas wrote: > I'm currently trying to understand an error when using the dokuwikixmlrpc > python module, allowing to easily work with DokuWiki RPC interface. > > Another description of the problem : > https://github.com/kynan/dokuwikixmlrpc/issues/8 > > H

Re: name for a mutually inclusive relationship

2021-02-24 Thread 2QdxY4RzWzUUiLuE
On 2021-02-24 at 08:12:58 -0800, Ethan Furman wrote: > I'm looking for a name for a group of options that, when one is specified, > all of them must be specified. > > For contrast, > > - radio buttons: a group of options where only one can be specified (mutually > exclusive) > - check boxes:

Re: name for a mutually inclusive relationship

2021-02-24 Thread 2QdxY4RzWzUUiLuE
On 2021-02-24 at 13:05:05 -0800, Ethan Furman wrote: > entangled (none or all): > >image size override: height width IMO, that's *one* option (-s 640x480 or -s 640,480), not two. In argparse/optparse terms, a required argument with a custom type. (OTOH, in a GUI, it'd be two separate m

Re: name for a mutually inclusive relationship

2021-02-24 Thread 2QdxY4RzWzUUiLuE
On 2021-02-24 at 13:31:42 -0800, Ethan Furman wrote: > On 2/24/21 1:23 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: > > > > entangled (none or all): > > > > > > image size override: height width > > > > IMO, that's *one* option (-s 640x480 or -s 640,480), not two. In > > argparse/optp

Re: editor recommendations?

2021-02-26 Thread 2QdxY4RzWzUUiLuE
On 2021-02-26 at 06:51:02 -0800, Ethan Furman wrote: > [...] vim [...] truly black screens with it. By which I mean that I > have a colorful window title bar, a light-grey menu bar, and then a > light-grey frame around the text-editing window (aka the only window), > and a nice, black-background

Re: pygame "font not intialized"

2021-03-12 Thread 2QdxY4RzWzUUiLuE
On 2021-03-12 at 17:27:36 -0500, Quentin Bock wrote: > my code is almost identical to this so I hope it's okay that I don't > include all of my code > error message: > font = pygame.font.Font('freesansbold.ttf', 32) > pygame.error: font not initialized > > Tutorial Link: https://www.youtube.com/

Re: convert script awk in python

2021-03-26 Thread 2QdxY4RzWzUUiLuE
On 2021-03-26 at 21:06:19 -0400, Avi Gross via Python-list wrote: > A generator that opens one file at a time (or STDIN) in a consistent > manner, would be a reasonable thing to have as part of emulating AWK. https://docs.python.org/3/library/fileinput.html -- https://mail.python.org/mailman/li

Re: A 35mm film camera represented in Python object

2021-04-01 Thread 2QdxY4RzWzUUiLuE
On 2021-04-01 at 18:10:46 -0400, Richard Damon wrote: > On 4/1/21 5:47 PM, D.M. Procida wrote: > > D.M. Procida wrote: > > > >> Hi everyone, I've created - > >> a representation of a Canonet G-III QL17 in Python. > >> > >> There's also documentation:

Re: Friday Finking: initialising values and implied tuples

2021-04-02 Thread 2QdxY4RzWzUUiLuE
On 2021-04-02 at 19:25:07 -0300, Marco Ippolito wrote: > > (a) basic linear presentation: > > > > resource = "Oil" > > time = 1 > > crude = 2 > > residue = 3 > > my_list = "long" > > > > (b) using explicit tuples: > > > > ( resource, time, crude, residue, my_list ) = ( "Oil", 1, 2, 3, "long" )

Re: Friday Finking: initialising values and implied tuples

2021-04-02 Thread 2QdxY4RzWzUUiLuE
On 2021-04-03 at 02:41:59 +0100, Rob Cliffe via Python-list wrote: >     x1 = 42; y1 =  3;  z1 = 10 >     x2 = 41; y2 = 12; z2 = 9 >     x3 =  8;  y3 =  8;  z3 = 10 > (please imagine it's in a fixed font with everything neatly vertically > aligned). > This has see-at-a-glance STRUCTURE: the lette

Re: Friday Finking: initialising values and implied tuples

2021-04-04 Thread 2QdxY4RzWzUUiLuE
On 2021-04-05 at 11:47:53 +1200, dn via Python-list wrote: > Did you spot how various contributors identified when they prefer one > method in a specific situation, but reach for another under differing > circumstances! What? Use cases matter? I'm *shocked*. :-/ Of all the methodologies I us

Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-08 Thread 2QdxY4RzWzUUiLuE
On 2021-04-09 at 00:17:59 +1000, Chris Angelico wrote: > Also, you'd better be really REALLY sure that your monitoring is > legal, ethical, and not deceptive. Not to mention *secure*. Your monitor increases the attack surface of the system as a whole. If I break into your monitor, can I recove

Re: Style qeustion: Multiple return values

2021-04-12 Thread 2QdxY4RzWzUUiLuE
On 2021-04-12 at 09:54:13 -0700, Dan Stromberg wrote: > On Mon, Apr 12, 2021 at 1:30 AM Steve Keller wrote: > > > Just a short style question: When returning multiple return values, do > > you use parenthesis? > > > > E.g. would you write > > > > def foo(): > > return 1, 2 > > > >

Re: Comparing text strings

2021-04-12 Thread 2QdxY4RzWzUUiLuE
On 2021-04-12 at 16:11:21 -0700, Rich Shepard wrote: > I'm running Slackware64-14.2 and keep a list of installed packages. When a > package is upgraded I want to remove the earlier version, and I've not > before written a script like this. Could there be a module or tool that > already exists to

Re: Not found in the documentation

2021-04-26 Thread 2QdxY4RzWzUUiLuE
On 2021-04-26 at 18:24:18 -0700, elas tica wrote: > [...] I was expecting to find [a description of what str returns for > various types] in the Built-in Types section from the PSL > documentation. The representation returned by str over a complex > number is not stated. The same for fraction obj

Re: name for new Enum decorator

2021-05-27 Thread 2QdxY4RzWzUUiLuE
On 2021-05-27 at 20:23:29 -0700, Regarding "name for new Enum decorator," Ethan Furman wrote: > Greetings! > > The Flag type in the enum module has had some improvements, but I find it > necessary to move one of those improvements into a decorator instead, and > I'm having a hard time thinking u

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread 2QdxY4RzWzUUiLuE
On 2021-09-01 at 08:36:55 +1200, dn via Python-list wrote: > ... there is less consideration about working-out what time it is in > Pune cf Kolkata, than between (say) San Francisco and Denver - > although they are in the same country, are they in the same time-zone, > or not? (they aren't!) Wh

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread 2QdxY4RzWzUUiLuE
On 2021-09-01 at 07:32:43 +1000, Chris Angelico wrote: > On Wed, Sep 1, 2021 at 7:17 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > What about Phoenix? In the winter, it's the same time there as it is in > > San Francisco, but in the summer, it's the same time there as it is in > > Denver (

Re: Scraping of Google Map to get the address of locations for given geocodes.

2021-09-02 Thread 2QdxY4RzWzUUiLuE
On 2021-09-02 at 20:12:19 -0300, Michio Suginoo wrote: > I have the following question regarding how to scrape Google Map to get > address based on a given list of geocodes. > Given a list of geocodes (latitude; longitude) of locations, I would like > to scrape municipalities of all the spots in

Re: on writing a while loop for rolling two dice

2021-09-06 Thread 2QdxY4RzWzUUiLuE
On 2021-09-06 at 20:11:41 -0400, Avi Gross via Python-list wrote: > And in the python version, has anyone made a generator that returned > NULL or the like so you can say uselessly: > > for ( _ in forever() ) ... while "forever": ... -- https://mail.python.org/mailman/listinfo/pyth

Re: Friday Finking: Contorted loops

2021-09-09 Thread 2QdxY4RzWzUUiLuE
On 2021-09-09 at 22:33:16 +, Stefan Ram wrote: > One can think of a language where every loop is exited this > way, the only loop construct would be > > loop > ... > > and it would /always/ have to be exited via enclosed breaks. I'm not quite sure what you mean by "one can," but

Re: Friday Finking: Contorted loops

2021-09-10 Thread 2QdxY4RzWzUUiLuE
On 2021-09-10 at 15:08:19 -0600, Joe Pfeiffer wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > > The existence of statements like "break" renders > > proof techniques for loops (such as Hoare's) with > > their invariants and inference rules unapplicable. > > Also the reason to avo

Re: Friday Finking: Contorted loops

2021-09-12 Thread 2QdxY4RzWzUUiLuE
On 2021-09-11 at 18:21:17 +0100, Alan Gauld via Python-list wrote: > On 11/09/2021 15:41, Peter J. Holzer wrote: > > > How is C's do/while loop more horrible than Pascal's repeat/until? > > Because it is very hard to spot or distinguish from a normal > while loop. > > while condition ; > > I

Re: Polymorphic imports

2021-09-21 Thread 2QdxY4RzWzUUiLuE
On 2021-09-22 at 05:10:02 +1000, Chris Angelico wrote: > You can dynamically import modules using importlib.import_module(), > but an easier way might just be a conditional import: > > # client/__init__.py > if some_condition: > import module_a_default as module_a > else: > import module

  1   2   >