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

2023-02-04 Thread Thomas Passin
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. I thought to read the lftp log file where I have these lines: 2023-01-30 18:30:02 /home/my_user/local_folder/upload/my_file_30-01-2023_18-30.txt -> sftp://ftp_u

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

2023-02-04 Thread Thomas Passin
On 2/4/2023 10:13 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: 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

Re: tree representation of Python data

2023-02-08 Thread Thomas Passin
On 2/8/2023 6:39 AM, Shaozhong SHI wrote: What is the robust way to use Python to read in an XML and turn it into a JSON file? JSON dictionary is actually a tree.  It is much easier to manage the tree-structured data. XML and JSON are both for interchanging data. What are you trying to acc

Re: evaluation question

2023-02-10 Thread Thomas Passin
On 2/10/2023 4:55 PM, Python wrote: However, Python's print() function is more analogous to C's printf(), which returns the number of characters converted for an entirely different reason... It's precisely so that you'll know what the length of the string that was converted is. This is most usef

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-12 Thread Thomas Passin
On 2/12/2023 6:10 AM, John O'Hagan wrote: On Mon, 2023-02-06 at 10:19 -0800, stefalem wrote: Il giorno sabato 4 febbraio 2023 alle 11:43:29 UTC+1 John O'Hagan ha scritto: ... Is there another way to do what I want? from tkinter import * from tkinter.ttk import * root = Tk() t = Treeview(roo

Re: Changing the original SQLite version to the latest

2023-02-14 Thread Thomas Passin
On 2/14/2023 3:30 PM, jose isaias cabrera wrote: Greetings. I have tried both Cygwin and SQLite support, and I have received very little ideas from them, so I am trying this to see if anyone has dealt with such a problem before. If I use Cygwin setup tool and install python39 and thus, $ pytho

Re: Changing the original SQLite version to the latest

2023-02-14 Thread Thomas Passin
On 2/14/2023 9:29 PM, jose isaias cabrera wrote: On Tue, Feb 14, 2023 at 8:55 PM Thomas Passin wrote: As a point of reference, the Python installation I've got on my Windows box (not a cygwin install) is Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec 6 2022, 20:01:21) [MSC v.1934 64 bit (

Re: Precision Tail-off?

2023-02-17 Thread Thomas Passin
On 2/17/2023 5:27 AM, Stephen Tucker wrote: Thanks, one and all, for your reponses. This is a hugely controversial claim, I know, but I would consider this behaviour to be a serious deficiency in the IEEE standard. Consider an integer N consisting of a finitely-long string of digits in base 10.

Re: LRU cache

2023-02-18 Thread Thomas Passin
On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote: I sometimes use this trick, which I learnt from a book by Martelli. Instead of try/except, membership testing with "in" (__contains__) might be faster. Probably "depends". Matter of measuring. def somefunc(arg, _cache={}):     if

Re: Comparing caching strategies

2023-02-18 Thread Thomas Passin
On 2/18/2023 2:59 PM, avi.e.gr...@gmail.com wrote: I do not know the internals of any Roaring Bitmap implementation so all I did gather was that once the problem is broken into accessing individual things I chose to call zones for want of a more specific name, then each zone is stored in one of a

Re: Comparing caching strategies

2023-02-18 Thread Thomas Passin
On 2/18/2023 5:55 PM, Peter J. Holzer wrote: On 2023-02-18 15:59:32 -0500, Thomas Passin wrote: On 2/18/2023 2:59 PM, avi.e.gr...@gmail.com wrote: I do not know the internals of any Roaring Bitmap implementation so all I did gather was that once the problem is broken into accessing individual

Re: File write, weird behaviour

2023-02-19 Thread Thomas Passin
On 2/19/2023 11:57 AM, Axy via Python-list wrote: Looks like the data to be written is buffered, so actual write takes place after readlines(), when close() flushes buffers. See io package documentation, BufferedIOBase. The solution is file.flush() after file.write() Another possibility, fro

Re: File write, weird behaviour

2023-02-19 Thread Thomas Passin
On 2/19/2023 1:53 PM, Chris Angelico wrote: On Mon, 20 Feb 2023 at 03:41, Azizbek Khamdamov wrote: Example 1 (works as expected) file = open("D:\Programming\Python\working_with_files\cities.txt", 'r+') ## contains list cities Side note: You happened to get lucky with P, w, and c, but for th

Re: File write, weird behaviour

2023-02-19 Thread Thomas Passin
On 2/19/2023 2:31 PM, Chris Angelico wrote: On Mon, 20 Feb 2023 at 06:24, Thomas Passin wrote: On 2/19/2023 1:53 PM, Chris Angelico wrote: On Mon, 20 Feb 2023 at 03:41, Azizbek Khamdamov wrote: Example 1 (works as expected) file = open("D:\Programming\Python\working_with_files\citie

Re: File write, weird behaviour

2023-02-19 Thread Thomas Passin
On 2/19/2023 6:10 PM, Mats Wichmann wrote: On 2/19/23 14:06, Dieter Maurer wrote: Azizbek Khamdamov wrote at 2023-2-19 19:03 +0500: ... Example 2 (weird behaviour) file = open("D:\Programming\Python\working_with_files\cities.txt", 'r+') ## contains list cities # the following code DOES NOT add

Re: Tuple Comprehension ???

2023-02-21 Thread Thomas Passin
On 2/21/2023 12:32 PM, Axy via Python-list wrote: On 21/02/2023 04:13, Hen Hanna wrote: (A)   print( max( * LisX )) (B)   print( sum( * LisX ))    <--- Bad syntax !!! What's most surprising is (A)  is ok, and  (B) is not.     even th

Re: Tuple Comprehension ???

2023-02-21 Thread Thomas Passin
On 2/21/2023 8:52 PM, Hen Hanna wrote: On Tuesday, February 21, 2023 at 10:39:54 AM UTC-8, Thomas Passin wrote: On 2/21/2023 12:32 PM, Axy via Python-list wrote: On 21/02/2023 04:13, Hen Hanna wrote: (A) print( max( * LisX )) (B) print( sum( * LisX

Re: Python + Vim editor

2023-02-21 Thread Thomas Passin
On 2/21/2023 9:00 PM, Hen Hanna wrote: what editor do you (all) use to write Python code? (i use Vim) I usually use the Leo-editor (https://github.com/leo-editor/leo-editor or PyPi). It's wonderful once you get it figured out but it's got a real learning curve. -- https://mail.python.org

Re: Python + Vim editor

2023-02-21 Thread Thomas Passin
On 2/22/2023 12:00 AM, orzodk wrote: Thomas Passin writes: On 2/21/2023 9:00 PM, Hen Hanna wrote: what editor do you (all) use to write Python code? (i use Vim) I usually use the Leo-editor (https://github.com/leo-editor/leo-editor or PyPi). It's wonderful once you get it figured ou

Re: Line continuation and comments

2023-02-22 Thread Thomas Passin
On 2/22/2023 10:02 AM, Weatherby,Gerard wrote: That’s a neat tip. End of line comments work, too x = (3 > 4 #never and 7 == 7 # hopefully or datetime.datetime.now().day > 15 # sometimes ) print(x) I find myself doing this more and more often. It can also help to make the

Re: Python + Vim editor

2023-02-22 Thread Thomas Passin
On 2/22/2023 1:45 PM, orzodk wrote: Thomas Passin writes: On 2/22/2023 12:00 AM, orzodk wrote: Thomas Passin writes: On 2/21/2023 9:00 PM, Hen Hanna wrote: what editor do you (all) use to write Python code? (i use Vim) I usually use the Leo-editor (https://github.com/leo-editor/leo

Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Thomas Passin
On 2/22/2023 3:12 PM, Hen Hanna wrote: On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote: Hello, all. Does Python have an instrospection facility that can determine to which outer variable a function argument is bound, e.g.: v1 = 5; v2 = 5; do some Python coders like

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

2023-02-22 Thread Thomas Passin
On 2/22/2023 6:46 PM, Hen Hanna wrote: On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote: py bug.py Traceback (most recent call last): File "C:\Usenet\bug.py", line 5, in print( a + 12 ) TypeError: can only concatenate str (not "int") to str Why doesn't Python (error msg)

Re: semi colonic

2023-02-22 Thread Thomas Passin
On 2/22/2023 7:58 PM, avi.e.gr...@gmail.com wrote: Thomas, This is one of many little twists I see between languages where one feature impacts use or even the need for another feature. So can anyone point to places in Python where a semicolon is part of a best or even good way to do anything

Re: semi colonic

2023-02-22 Thread Thomas Passin
On 2/22/2023 10:42 PM, avi.e.gr...@gmail.com wrote: That seems like a reasonable if limited use of a semi-colon, Thomas. Of course, most shells will allow a multi-line argument too like some AWK scripts I have written with a quote on the first line followed by multiple lines of properly

Re: Error-Msg Jeannie's charming, teasing ways

2023-02-23 Thread Thomas Passin
On 2/23/2023 10:58 PM, Cameron Simpson wrote: On 23Feb2023 14:58, Hen Hanna wrote: Python's Error-Msg  genie  (Jeannie)  is cute and fickle...   She sometimes teases me by not telling me what the VALUE of the   "int"  is     ( "That's for me to know, and for you to find out

Re: putting JUNK at the end of a [.py] file

2023-02-23 Thread Thomas Passin
On 2/23/2023 7:21 PM, Hen Hanna wrote: in a LaTeX file, after the (1st) \end{document} line, i can put any random Junk i want(afterwards) until the end of the file. Is there a similar Method for a.py file ? Since i know of no such trick, i sometimes put

Re: putting JUNK at the end of a [.py] file

2023-02-24 Thread Thomas Passin
On 2/24/2023 12:37 AM, Hen Hanna wrote: On Thursday, February 23, 2023 at 9:17:05 PM UTC-8, Thomas Passin wrote: On 2/23/2023 7:21 PM, Hen Hanna wrote: in a LaTeX file, after the (1st) \end{document} line, i can put any random Junk i want (afterwards) until the end of the file. Is there a

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

2023-02-24 Thread Thomas Passin
On 2/24/2023 2:47 PM, dn via Python-list wrote: On 25/02/2023 08.12, Peter J. Holzer wrote: On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: In some ways, providing this information seems appropriate. Curiously, this does not even occur during an assert exception - despite the value/rel

Re: Evaluate once or every time

2023-02-24 Thread Thomas Passin
On 2/24/2023 5:35 PM, avi.e.gr...@gmail.com wrote: Mark, I was very interested in the point you made and have never thought much about string concatenation this way but adjacency is an operator worth using. This message has a new subject line as it is not about line continuation or comments.

Re: Evaluate once or every time

2023-02-24 Thread Thomas Passin
On 2/24/2023 7:00 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: 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

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

2023-02-25 Thread Thomas Passin
On 2/25/2023 1:13 AM, Peter J. Holzer wrote: On 2023-02-24 18:19:52 -0500, Thomas Passin wrote: On 2/24/2023 2:47 PM, dn via Python-list wrote: On 25/02/2023 08.12, Peter J. Holzer wrote: On 2023-02-24 16:12:10 +1300, dn via Python-list wrote: In some ways, providing this information seems

Re: Is there a more efficient threading lock?

2023-02-25 Thread Thomas Passin
On 2/25/2023 10:52 AM, Skip Montanaro wrote: I have a multi-threaded program which calls out to a non-thread-safe library (not mine) in a couple places. I guard against multiple threads executing code there using threading.Lock. The code is straightforward: from threading import Lock # Somethin

Re: Is there a more efficient threading lock?

2023-02-25 Thread Thomas Passin
On 2/25/2023 4:41 PM, Skip Montanaro wrote: Thanks for the responses. Peter wrote: Which OS is this? MacOS Ventura 13.1, M1 MacBook Pro (eight cores). Thomas wrote: > I'm no expert on locks, but you don't usually want to keep a lock while > some long-running computati

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

2023-02-26 Thread Thomas Passin
On 2/25/2023 8:12 PM, Hen Hanna wrote: 2. the rude guy ('dn') hasn't offered a single word of comment that's directly relevant to it. > but he did offer related stuff which he thinks i should be [grateful] for Please let's stop the ad hominem messages. If someone

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

2023-02-26 Thread Thomas Passin
On 2/26/2023 8:40 PM, MRAB wrote: On 2023-02-26 16:56, Hen Hanna wrote: On Sunday, February 26, 2023 at 6:41:01 AM UTC-8, Thomas Passin wrote: On 2/25/2023 8:12 PM, Hen Hanna wrote: > 2. the rude guy ('dn') hasn't offered a single word of comment that's d

Re: Python 3.10 Fizzbuzz

2023-02-27 Thread Thomas Passin
On 2/27/2023 11:01 AM, Mats Wichmann wrote: On 2/26/23 14:07, Hen Hanna wrote: On Monday, August 29, 2022 at 7:18:22 PM UTC-7, Paul Rubin wrote: Just because. from math import gcd def fizz(n: int) -> str:     match gcd(n, 15):    case 3: return "Fizz"    case 5:

Re: Hen Hanna & google groups

2023-02-27 Thread Thomas Passin
On 2/27/2023 12:35 PM, Ethan Furman wrote: Greetings, all! As has been stated, Hen Hanna is posting through Google Groups, over which the Python List moderators have zero control. The only thing we can do, and which has now been done, is not allow those posts in to the Python List. -- ~Eth

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

2023-02-27 Thread Thomas Passin
On 2/27/2023 2:15 PM, avi.e.gr...@gmail.com wrote: Karsten, There are limits to the disruption a group should tolerate even from people who may need some leeway. I wonder if Hen Hanna has any idea that some of the people he is saying this to lost most of their family in the Holocaust and had pa

Re: How to escape strings for re.finditer?

2023-02-27 Thread Thomas Passin
On 2/27/2023 9:16 PM, avi.e.gr...@gmail.com wrote: And, just for fun, since there is nothing wrong with your code, this minor change is terser: example = 'X - abc_degree + 1 + qq + abc_degree + 1' for match in re.finditer(re.escape('abc_degree + 1') , example): ... print(match.start(), ma

Re: How to escape strings for re.finditer?

2023-02-28 Thread Thomas Passin
On 2/28/2023 4:33 AM, Roel Schroeven wrote: Op 28/02/2023 om 3:44 schreef Thomas Passin: On 2/27/2023 9:16 PM, avi.e.gr...@gmail.com wrote: And, just for fun, since there is nothing wrong with your code, this minor change is terser: example = 'X - abc_degree + 1 + qq + abc_degree + 1

Re: How to escape strings for re.finditer?

2023-02-28 Thread Thomas Passin
On 2/28/2023 10:05 AM, Roel Schroeven wrote: Op 28/02/2023 om 14:35 schreef Thomas Passin: On 2/28/2023 4:33 AM, Roel Schroeven wrote: [...] (2) Searching for a string in another string, in a performant way, is not as simple as it first appears. Your version works correctly, but slowly. In

Re: How to escape strings for re.finditer?

2023-02-28 Thread Thomas Passin
On 2/28/2023 1:07 PM, Jen Kris wrote: Using str.startswith is a cool idea in this case.  But is it better than regex for performance or reliability?  Regex syntax is not a model of simplicity, but in my simple case it's not too difficult. The trouble is that we don't know what your case real

Re: How to escape strings for re.finditer?

2023-02-28 Thread Thomas Passin
On 2/28/2023 12:57 PM, Jen Kris via Python-list wrote: The code I sent is correct, and it runs here.  Maybe you received it with a carriage return removed, but on my copy after posting, it is correct: example = 'X - abc_degree + 1 + qq + abc_degree + 1'  find_string = re.escape('abc_degree + 1

Re: How to escape strings for re.finditer?

2023-02-28 Thread Thomas Passin
On 2/28/2023 11:48 AM, Jon Ribbens via Python-list wrote: On 2023-02-28, Thomas Passin wrote: ... It is interesting, though, how pre-processing the search pattern can improve search times if you can afford the pre-processing. Here's a paper on rapidly finding matches when there may be

Re: How to escape strings for re.finditer?

2023-02-28 Thread Thomas Passin
On 2/28/2023 2:40 PM, David Raymond wrote: With a slight tweak to the simple loop code using .find() it becomes a third faster than the RE version though. def using_simple_loop2(key, text): matches = [] keyLen = len(key) start = 0 while (foundSpot := text.find(key, start))

Re: How to escape strings for re.finditer?

2023-03-01 Thread Thomas Passin
On 3/1/2023 12:04 PM, Grant Edwards wrote: On 2023-02-28, Cameron Simpson wrote: Regexps are: - cryptic and error prone (you can make them more readable, but the notation is deliberately both terse and powerful, which means that small changes can have large effects in behaviour); the "

Re: How to fix this issue

2023-03-01 Thread Thomas Passin
On 3/1/2023 1:26 PM, Mats Wichmann wrote: On 2/27/23 17:51, Arslan Mehmood wrote: How I can remove python terminl, its again and again open during working in python. Please help me to resolve this issue. Python 3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on

Re: How to fix this issue

2023-03-01 Thread Thomas Passin
On 3/1/2023 8:23 PM, Rob Cliffe via Python-list wrote: On 01/03/2023 18:46, Thomas Passin wrote: If this is what actually happened, this particular behavior occurs because Python on Windows in a console terminates with a instead of the usual . I think you mean . Correct! I double

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-02 Thread Thomas Passin
On 3/2/2023 3:54 PM, Ian Pilcher wrote: Seems like an FAQ, and I've found a few things on StackOverflow that discuss the technical differences in edge cases, but I haven't found anything that talks about which form is considered to be more Pythonic in those situations where there's no functional

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-02 Thread Thomas Passin
On 3/2/2023 5:53 PM, Greg Ewing via Python-list wrote: On 3/03/23 9:54 am, Ian Pilcher wrote: I haven't found anything that talks about which form is considered to be more Pythonic in those situations where there's no functional difference. In such cases I'd probably go for type(x), because it

Re: Python list insert iterators

2023-03-03 Thread Thomas Passin
On 3/3/2023 3:22 AM, Guenther Sohler wrote: Hi Python community, I have a got an example list like 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 T T and i eventually want to insert items in the given locations (A shall go between 2 and 3, B shall go between 6 and 7) Right now i jus

Re: Testing list sequence question

2023-03-04 Thread Thomas Passin
On 3/4/2023 11:38 AM, Gabor Urban wrote: Hi guys, I have a strange problem that I do not understand. I am testing function which returns a dictionary. The code should ensure that the keys of the dictionary are generated in a given order. I am testing the function with the standard unittest mo

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-04 Thread Thomas Passin
On 3/4/2023 2:47 AM, Peter J. Holzer wrote: Even before Python existed there was the adage "a real programmer can write FORTRAN in any language", indicating that idiomatic usage of a language is not governed by syntax and library alone, but there is a cultural element: People writing code in a sp

Re: Testing list sequence question

2023-03-04 Thread Thomas Passin
On 3/4/2023 1:42 PM, Roel Schroeven wrote: Thomas Passin schreef op 4/03/2023 om 18:49: On 3/4/2023 11:38 AM, Gabor Urban wrote: >   Hi guys, > > I have a strange problem that I do not understand. I am testing function > which returns a dictionary. The code should ensure that the

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-04 Thread Thomas Passin
On 3/4/2023 4:18 PM, avi.e.gr...@gmail.com wrote: I don't know, Thomas. For some simple programs, there is some evolutionary benefit by starting with what you know and gradually growing from there. He first time you need to do something that seems to need a loop in python, there are loo

Re: hi

2023-03-04 Thread Thomas Passin
On 3/4/2023 12:13 PM, Tom wrote: Bonjour je suis français et je ne comprend pas comment je peux acceder a python merci de me repondre CORDIALEMENT Lilian Envoyé à partir de [1]Courrier pour Windows Veuillez expliquer ce que vous entendez par "peux accéder à un python".

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-05 Thread Thomas Passin
On 3/4/2023 11:12 PM, Dino wrote: On 3/4/2023 10:43 PM, Dino wrote: I need fast text-search on a large (not huge, let's say 30k records totally) list of items. Here's a sample of my raw data (a list of US cars: model and make) I suspect I am really close to answering my own question... >>

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread Thomas Passin
On 3/6/2023 10:32 AM, Weatherby,Gerard wrote: Not sure if this is what Thomas meant, but I was also thinking dictionaries. Dino could build a set of dictionaries with keys “a” through “z” that contain data with those letters in them. (I’m assuming case insensitive search) and then just search

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread Thomas Passin
On 3/6/2023 7:28 AM, Dino wrote: On 3/5/2023 9:05 PM, Thomas Passin wrote: I would probably ingest the data at startup into a dictionary - or perhaps several depending on your access patterns - and then you will only need to to a fast lookup in one or more dictionaries. If your access

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread Thomas Passin
On 3/6/2023 12:49 PM, avi.e.gr...@gmail.com wrote: Thomas, I may have missed any discussion where the OP explained more about proposed usage. If the program is designed to load the full data once, never get updates except by re-reading some file, and then handles multiple requests, then some

Winodws10 Command Prompt unresponsive to .py commands

2023-03-07 Thread Thomas Gregg
Hi, I got python 11 to work with the esptool a few days ago. However, I must have something wrong, because now, when I enter any command with .py, Windows Command Prompt just returns without doing anything. Example C:\Users\gregg>esptool.py version C:\Users\gregg> I tried to change the Window

Python 3.12.0 alpha 6 released

2023-03-07 Thread Thomas Wouters
nged in preparation for performance enhancements. (This should not affect most users as it is an internal detail, but it may cause problems for Cython-generated code.) - (Hey, fellow core developer, if a feature you find important is missing from this list, let Thomas know .) For more details on the

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-07 Thread Thomas Passin
On 3/7/2023 7:33 AM, Dino wrote: It must be nice to have a server or two... No kidding About everything else you wrote, it makes a ton of sense, in fact it's a dilemma I am facing now. My back-end returns 10 entries (I am limiting to max 10 matches server side for reasons you can imagine). A

Re: Winodws10 Command Prompt unresponsive to .py commands

2023-03-07 Thread Thomas Passin
On 3/7/2023 2:31 PM, Thomas Gregg wrote: Hi, I got python 11 to work with the esptool a few days ago. However, I must have something wrong, because now, when I enter any command with .py, Windows Command Prompt just returns without doing anything. Example C:\Users\gregg>esptool.py version

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-08 Thread Thomas Passin
On 3/8/2023 3:27 PM, Peter J. Holzer wrote: On 2023-03-08 00:12:04 -0500, Thomas Passin wrote: On 3/7/2023 7:33 AM, Dino wrote: in fact it's a dilemma I am facing now. My back-end returns 10 entries (I am limiting to max 10 matches server side for reasons you can imagine). As the user

Re: JOB | Lead Linux Sysadmin (Edinburgh/London)

2023-03-08 Thread Thomas Gregg
Is there any way to be removed from this list? Thank you, Tom On Wed, Mar 8, 2023 at 3:51 PM Skip Montanaro wrote: > > Hello, I'm working with an employer that is looking to hire someone in > > (Edinburgh or London) that can administer on-prem and vmware > > platforms. > > > > James, > > If you

Re: Lambda returning tuple question, multi-expression

2023-03-08 Thread Thomas Passin
On 3/8/2023 4:56 PM, aapost wrote: b = tk.Button(master=main, text="Enable") b.config(     command=lambda: (     e1.config(state="normal"),     e2.config(state="normal"),     e3.config(state="normal")     ) ) It's hard to understand what you are trying to do here. I don't rem

Re: Lambda returning tuple question, multi-expression

2023-03-08 Thread Thomas Passin
On 3/8/2023 11:19 PM, aapost wrote: > In both cases (as per my intent) Well, that's the trouble. You haven't stated your intent, so we're forced to try to reverse engineer it. Below I state what my reverse-engineering effort thinks is your intent. It would be better if you actually said clea

Re: Lambda returning tuple question, multi-expression

2023-03-09 Thread Thomas Passin
On 3/9/2023 3:29 AM, aapost wrote: The 'what I am trying to do' is ask a question regarding opinions and practices on issuing a sequence of actions within a lambda via a tuple (since the common practice approaches against it - mainly with tkinter - feel more convoluted), and in doing so leaving

Re: Python installation not full and python not working 3.11.0

2023-03-10 Thread Thomas Passin
On 3/10/2023 6:27 PM, Jan Vasko wrote: Please note that you can't attach images in these posts, at least not so we can read them. Instead, copy the messages from the console and paste them into your post. I suggest that you check to make sure that your system hasn't been damaged or corrupte

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Thomas Passin
On 3/10/2023 7:07 PM, aapost wrote: which does start to break down readability due to line length, as there isn't really an indention rule set for something uncommonly used. but some renaming makes the pattern clearer pids.update({"messages" :subprocess.Popen(["cmd1"])}) if not pids["messages

Re: Python installation not full and python not working 3.11.0

2023-03-10 Thread Thomas Passin
On 3/10/2023 9:51 PM, Thomas Passin wrote: On 3/10/2023 6:27 PM, Jan Vasko wrote: Please note that you can't attach images in these posts, at least not so we can read them.  Instead, copy the messages from the console and paste them into your post. I suggest that you check to make sure

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Thomas Passin
On 3/10/2023 10:37 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: 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", &quo

Re: Lambda returning tuple question, multi-expression

2023-03-10 Thread Thomas Passin
On 3/10/2023 11:15 PM, aapost wrote: On 3/10/23 22:16, Thomas Passin wrote: [...] The additional note in the above is, when taking the def route above, the thing you would have to consider is what scope is the dictionary pids? Do you need to submit it to the lambda and subsequently the

Re: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-11 Thread Thomas Passin
On 3/11/2023 6:54 PM, a a wrote: My project https://www.mathworks.com/help/matlab/matlab_prog/loma-prieta-earthquake.html If your goal is to step through this Matlab example, then clearly you should use Matlab. If you do not have access to Matlab or cannot afford it, then you would have to us

Re: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-13 Thread Thomas Passin
On 3/13/2023 12:39 AM, a a wrote: But some unknown reasons Matplotlib and numpy crash my Python 3.8 for Windows , 32-bit and no support is offered It is possible, using pip, to downgrade versions (e.g., of Matplotlob and numpy) to see if you can find versions that work. Of course moving to

Re: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-13 Thread Thomas Passin
On 3/13/2023 12:39 AM, a a wrote: But what I need is analysis of seismograms from 4,000 seismographs world wide to detect P-wave energy distribution underground around the earthquake to verify EQ Domino Effect In that case, you will have to do a great deal of work to get all that data into a

Re: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-13 Thread Thomas Passin
On 3/13/2023 11:23 AM, Rich Shepard wrote: On Mon, 13 Mar 2023, Thomas Passin wrote: But what I need is analysis of seismograms from 4,000 seismographs world wide to detect P-wave energy distribution underground around the earthquake to verify EQ Domino Effect In that case, you will have

Re: Can you process seismographic signals in Python or should I switch to Matlab ?

2023-03-13 Thread Thomas Passin
On 3/13/2023 11:54 AM, Rich Shepard wrote:> On Mon, 13 Mar 2023, Thomas Passin wrote: > >> No doubt, depending on the data formats used. But it's still going >> to be a big task. > > Thomas, > > True, but once you have a dataframe with all the information

Re: =- and -= snag

2023-03-13 Thread Thomas Passin
On 3/13/2023 9:07 PM, Chris Angelico wrote: Of course, all this is predicated on you actually putting whitespace around your equals signs. If you write it all crunched together as "x=-5", there's no extra clues to work with. Linters and code reviewers can make use of all the available informatio

Re: =- and -= snag

2023-03-13 Thread Thomas Passin
On 3/13/2023 9:47 PM, Chris Angelico wrote: On Tue, 14 Mar 2023 at 12:38, Thomas Passin wrote: On 3/13/2023 9:07 PM, Chris Angelico wrote: Of course, all this is predicated on you actually putting whitespace around your equals signs. If you write it all crunched together as "x=-5"

Re: How to exit program with custom code and custom message?

2023-03-13 Thread Thomas Passin
On 3/13/2023 10:34 PM, scruel tao wrote: Lars: I totally understand your reasoning here, but in some way it follows the unix philosophy: Do only one thing, but do that good. I understand, python is not strongly typed, so `sys.exit` will be able to accept any types parameters rather than just

Re: How to exit program with custom code and custom message?

2023-03-13 Thread Thomas Passin
On 3/13/2023 11:50 PM, MRAB wrote: On 2023-03-14 03:29, Thomas Passin wrote: On 3/13/2023 10:34 PM, scruel tao wrote: Lars: I totally understand your reasoning here, but in some way it follows the unix philosophy: Do only one thing, but do that good. I understand, python is not strongly

Re: How to exit program with custom code and custom message?

2023-03-13 Thread Thomas Passin
On 3/13/2023 10:34 PM, scruel tao wrote: Interesting, `raise SystemExit` seems to have the same behavior as `sys.exit`: ```shell python -c "raise SystemExit(100)" echo $? <<< 100 python -c " import sys; sys.exit(100)" echo $? <<< 100 OTOH, you don't want to get too tricky: (on Windows, obvio

Re: Tkinter and cv2: "not responding" popup when imshow launched from tk app

2023-03-14 Thread Thomas Passin
On 3/14/2023 6:54 AM, John O'Hagan wrote: Hi list I'm trying to use cv2 to display images created as numpy arrays, from within a tkinter app (which does other things with the arrays before they are displayed as images). The arrays are colour-coded visualisations of genomes and can be over a bill

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Thomas Passin
On 3/14/2023 3:48 AM, Alexander Nestorov wrote: I'm working on an NLP and I got bitten by an unreasonably slow behaviour in Python while operating with small amounts of numbers. I have the following code: ```python import random, time from functools import reduce def trainPerceptron(perceptro

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-15 Thread Thomas Passin
On 3/15/2023 10:24 AM, David Raymond wrote: Or use the sum() builtin rather than reduce(), which was *deliberately* removed from the builtins. The fact that you can get sum() without importing, but have to go and reach for functools to get reduce(), is a hint that you probably shouldn't use reduc

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-15 Thread Thomas Passin
On 3/15/2023 11:01 AM, Chris Angelico wrote: On Thu, 16 Mar 2023 at 01:26, David Raymond wrote: I'm not quite sure why the built-in sum functions are slower than the for loop, or why they're slower with the generator expression than with the list comprehension. For small-to-medium data sizes

Re: Implementing a plug-in mechanism

2023-03-15 Thread Thomas Passin
On 3/15/2023 2:45 PM, dn via Python-list wrote: On 16/03/2023 01.47, Loris Bennett wrote: I have written a program which, as part of the non-core functionality, contains a module to generate email.  This is currently very specific to my organisation, so the main program contains    import myorg

Re: Implementing a plug-in mechanism

2023-03-15 Thread Thomas Passin
On 3/15/2023 6:06 PM, Weatherby,Gerard wrote: I do something similar to Thomas. (Also MIT licensed). I like objects. I like type hints. Each plugin needs to have check and purpose functions and accepts either PluginSpec (by default) or AddonSpec if it defines addon = True I omitted the

Re: Friday finking: IDE 'macro expansions'

2023-03-16 Thread Thomas Passin
On 3/16/2023 6:55 PM, dn via Python-list wrote: It is a long, long, time since I've thrown one of these into the maelstrom of our musings. (have the nightmares receded?) Do you make use of your IDE's expansionist tendencies, and if-so, which ones? NB this is where vi/emacs enthusiasts star

Re: Friday finking: IDE 'macro expansions'

2023-03-17 Thread Thomas Passin
On 3/17/2023 9:38 AM, Simon Ward wrote: On Fri, Mar 17, 2023 at 02:05:50PM +0100, Roel Schroeven wrote: Even better than simply highlighting is (IMO) a thing called "Rainbow Braces" or "Bracket Pair Colorization" I recently learned about: both braces of a matching pair get the same color, while

Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?

2023-03-17 Thread Thomas Passin
On 3/16/2023 8:07 PM, a a wrote: Crash report: Problem Caption: Problem Event Name: APPCRASH Application name: python.exe Application version: 3.8.7150.1013 Application time signature: 5fe0df5a Error module name: _multiarray_umath.cp38-win32.pyd Version of the module with t

Re: Fwd: Friday finking: IDE 'macro expansions'

2023-03-17 Thread Thomas Passin
On 3/17/2023 1:13 PM, Alan Gauld wrote: Oops! I meant to send this to the group not just Dave. Forwarded Message On 16/03/2023 22:55, dn via Python-list wrote: Do you make use of your IDE's expansionist tendencies, and if-so, which ones? When I'm writing Java/C++/C# yes,

Re: Fwd: Friday finking: IDE 'macro expansions'

2023-03-18 Thread Thomas Passin
On 3/18/2023 4:46 AM, Alan Gauld wrote: On 17/03/2023 17:55, Thomas Passin wrote: I used Delphi and Smalltalk/V which both pretty much only exist within their own IDEs and I used their features extensively. Back when Delphi first came out, when I first used it, I don't remember any IDE

Re: Fwd: Friday finking: IDE 'macro expansions'

2023-03-18 Thread Thomas Passin
On 3/18/2023 8:15 AM, Peter J. Holzer wrote: On 2023-03-18 08:46:42 +, Alan Gauld wrote: On 17/03/2023 17:55, Thomas Passin wrote: I used Delphi and Smalltalk/V which both pretty much only exist within their own IDEs and I used their features extensively. Back when Delphi first came out

Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?

2023-03-18 Thread Thomas Passin
On 3/17/2023 11:32 AM, a a wrote: On Friday, 17 March 2023 at 16:03:14 UTC+1, Thomas Passin wrote: It would be worth trying to downgrade the multiarray version to an earlier one and see if that fixes the problem. Thank you Thomas for your kind reply. I am fully aware to be living on an old

Re: Q: argparse.add_argument()

2023-03-18 Thread Thomas Passin
On 3/18/2023 2:02 PM, Gisle Vanem via Python-list wrote: I accidentally used 'argparse' like this in my Python 3.9 program:   parser.add_argument ("-c, --clean",  dest="clean", action="store_true")   parser.add_argument ("-n, --dryrun", dest="dryrun", action="store_true") instead of:   parser

Re: Numpy, Matplotlib crash Python 3.8 Windows 7, 32-bit - can you help ?

2023-03-18 Thread Thomas Passin
On 3/17/2023 11:52 AM, a a wrote: On Friday, 17 March 2023 at 16:32:53 UTC+1, a a wrote: On Friday, 17 March 2023 at 16:03:14 UTC+1, Thomas Passin wrote: On 3/16/2023 8:07 PM, a a wrote: Crash report: Problem Caption: Problem Event Name: APPCRASH Application name: python.exe Application

<    4   5   6   7   8   9   10   11   12   13   >