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 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 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: 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: Two standard outline editing commands

2023-03-02 Thread Thomas Passin
On Thursday, March 2, 2023 at 3:41:48 PM UTC-5 chr...@gmail.com wrote: If these two indeed don't exist, can they be added by scripting? via a plugin? Maybe I could dot hat, but am not yet quite sure yet, gotta read more doc. The best way to proceed, IMHO, is to develop the script in your wor

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: 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: 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: 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 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 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-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 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 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: Thumb-nail Explanation Of Leo

2023-02-28 Thread Thomas Passin
On Tuesday, February 28, 2023 at 12:03:04 PM UTC-5 off...@riseup.net wrote: I think that your explanation is pretty complete. For me, one of the most important aspects of Leo is that the structure of the plain-text documents is not only implicit, and in that sense "rarely visualized", as you p

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 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: Thumb-nail Explanation Of Leo

2023-02-27 Thread Thomas Passin
akes possible a divide-and-conquer strategy." On Sunday, February 26, 2023 at 6:02:29 PM UTC-5 Thomas Passin wrote: > Thanks ... I'll see how to work that in. It might fit in as one of the > key concepts. > > On Sunday, February 26, 2023 at 5:54:59 PM UTC-5 stevelitt wrote: &

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: Leo Themes - Tweaks and Comparisons

2023-02-27 Thread Thomas Passin
Looking at the images I just posted, they all have a slight lack of sharpness. It must be something about resizing done by Google Groups, because the originals look sharper. On Monday, February 27, 2023 at 9:18:45 PM UTC-5 Thomas Passin wrote: > From time to time I revisit Leo's colo

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: 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: 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: 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: Thumb-nail Explanation Of Leo

2023-02-26 Thread Thomas Passin
Thanks ... I'll see how to work that in. It might fit in as one of the key concepts. On Sunday, February 26, 2023 at 5:54:59 PM UTC-5 stevelitt wrote: > Thomas Passin said on Sat, 25 Feb 2023 09:11:31 -0800 (PST) > > > >Leo's key concepts include a tree-like organizati

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

Programming By Contract for Python

2023-02-25 Thread Thomas Passin
I just learned something new that may be of interest to some devs. There are a few packages that add Programming By Contract to Python. In particular, iContract: https://github.com/Parquery/icontract If you have not heard of this approach, it was introduced in the Eiffel language in the late

Re: Thumb-nail Explanation Of Leo

2023-02-25 Thread Thomas Passin
My last post was deleted for some reason. "*Literate Programming with Directed Acyclic Graphs (dag)" - *well, yes, but it's a very limited subset of what Leo can do. "*Use Leo, the Literate Editor with Outlines, to program with directed acyclic graphs, along with section-references, @others,

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 computation goes on.  You wan

Re: Thumb-nail Explanation Of Leo

2023-02-25 Thread Thomas Passin
On Saturday, February 25, 2023 at 12:11:31 PM UTC-5 I wrote: Leo is notoriously to explain to people. Most attempts start out something like "It's a text editor, an IDE, oh, yes, a PIM, and so much more". The listener is not very enlightened. That should have read "Leo is notoriously hard

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

Thumb-nail Explanation Of Leo

2023-02-25 Thread Thomas Passin
Leo is notoriously to explain to people. Most attempts start out something like "It's a text editor, an IDE, oh, yes, a PIM, and so much more". The listener is not very enlightened. I've been bugged by this, so I have been working on refining the Leo's purpose and key concepts. I'd like to

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: 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: 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: 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: 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: 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: 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: Leo 6.7.2 delayed until Friday, March 3

2023-02-23 Thread Thomas Passin
Thanks for still being the chief wrangler of all these activities! On Thursday, February 23, 2023 at 4:41:30 AM UTC-5 Edward K. Ream wrote: > On Wednesday, February 22, 2023 at 10:31:16 AM UTC-6 Edward K. Ream wrote: > Recent bugs make an extra week of testing seem prudent. > > *Status report* >

Re: semi colonic

2023-02-22 Thread Thomas Passin
old /usr/lib/python2.7/lib-dynload /usr/lib/python2.7/site-packages /usr/lib/python2.7/site-packages/gtk-2.0 -Original Message- From: Python-list On Behalf Of Thomas Passin Sent: Wednesday, February 22, 2023 9:05 PM To: python-list@python.org Subject: Re: semi colonic On 2/22/2023 7:58 PM,

New Command "execute-external-file" Now In Devel

2023-02-22 Thread Thomas Passin
The new command to run external files, "execute-external-file", is now in the devel branch. Thanks to all who helped me test and improve it! This new minibuffer command will find the nearest external file root node, try to figure out what kind of processor to run it - python, ruby, julia, etc.

Re: semi colonic

2023-02-22 Thread Thomas Passin
historical artifact. -Original Message----- From: Python-list On Behalf Of Thomas Passin Sent: Wednesday, February 22, 2023 7:24 PM To: python-list@python.org Subject: Re: Introspecting the variable bound to a function argument On 2/22/2023 3:12 PM, Hen Hanna wrote: On Wednesday, February

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

Links On Leo's GitHub Page Are Still Obsolete

2023-02-21 Thread Thomas Passin
Many of the links on the top GitHub page still point to leoeditor.com, and the Download link points to the old SourceForge page, with the latest version there going back to 2018. -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe fro

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: 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: 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: Command To Run External File

2023-02-21 Thread Thomas Passin
Thanks for testing! I was surprised by all the terminals available, too. On my Mint virtual machine ( I have lightly annotated the responses): tom@tom-VirtualBox:~$ find /usr/bin -name *term -type f /usr/bin/setterm # Not a terminal - controls terminal properties /usr/bin/xterm /usr/bin/

Re: Command To Run External File

2023-02-20 Thread Thomas Passin
That's a good idea! I think a setting would be the Leonine way to do it. When I convert this into a Leo command, I'll look at making it happen. On Monday, February 20, 2023 at 7:06:26 PM UTC-5 SegundoBob wrote: > Thomas Passin, > > Your fix passes all my tests. > >

Re: Command To Run External File

2023-02-20 Thread Thomas Passin
@mike, that was a good diagnosis. When Leo is not run from a terminal (in Linux), the process space does not include a terminal and the shell may not even be the same shell (e.g., *sh* instead of *bash*) as one might expect. I have revised the terminal-finding code for Linux to try several heu

Re: Command To Run External File

2023-02-20 Thread Thomas Passin
Oh, I understand now. Thank you. I'll see what can be done. On Monday, February 20, 2023 at 8:09:22 AM UTC-5 SegundoBob wrote: > On 2/19/23 18:25, Thomas Passin wrote: > > " but it does not work when I use the file browser Thunar to open the > > Leo-editor file"

Re: Command To Run External File

2023-02-19 Thread Thomas Passin
" but it does not work when I use the file browser Thunar to open the Leo-editor file". I don't understand what you mean here, @SegundoBob. The intended use is to select - within Leo - a node in an external file, and have it run in (or get launched by) a terminal. How does the file browser

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: 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 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 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: Command To Run External File

2023-02-19 Thread Thomas Passin
Thanks, I'd appreciate it. On Sunday, February 19, 2023 at 12:38:04 PM UTC-5 jkn wrote: > sorry, I have installed it but not tried it. I'll give it a go this week > > On Sunday, February 19, 2023 at 2:27:15 AM UTC tbp1...@gmail.com wrote: > >> If nobody complains about it in another week, I'll pa

Re: Command To Run External File

2023-02-18 Thread Thomas Passin
If nobody complains about it in another week, I'll package it up as a new Leo command. On Monday, February 6, 2023 at 4:15:40 AM UTC-5 jkn wrote: > I'll give it a try (kubuntu linux, mainly) and let you know what I find... > > On Monday, February 6, 2023 at 6:18:42 AM UTC tbp1...@gmail.com wrote

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: 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: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-18 Thread Thomas Passin
11:45:05 AM UTC-5 Edward K. Ream wrote: > On Fri, Feb 17, 2023 at 5:00 PM Thomas Passin wrote: > >> Here is a script so you can see if you like the effect of having a >> non-monospaced font for non-code bodies. > > > Thanks, Thomas, for this work. PR #3150 > <

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: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-17 Thread Thomas Passin
lf_and_parents(): if has_direct(p.b, p.h): css = STYLE break editor = c.frame.body.wrapper.widget editor.setStyleSheet(css) ud = g.user_dict ud['alt_body_font_proc'] = set_alt_body_font g.registerHandler('select3', ud['alt_body_f

Re: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-17 Thread Thomas Passin
Here is a script so you can see if you like the effect of having a non-monospaced font for non-code bodies. It only works for @language rest nodes. Copy the script below into a node in your workbook. Run it with CTRL-B. After that, any time you switch to an *@language rest* node, it will use

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: Feature to upgrade leoInteg and vscode

2023-02-16 Thread Thomas Passin
And done ... On Thursday, February 16, 2023 at 8:47:57 AM UTC-5 Edward K. Ream wrote: > On Thu, Feb 16, 2023 at 12:31 AM Félix wrote: > >> If you feel like it and have 5 seconds of free time, I would recommend >> upvoting this vscode feature request, which could benefit leoInteg and >> leojs :

Re: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-15 Thread Thomas Passin
The only place the jEdit colorizer does anything about fonts is this: def getFontFromParams(self, family: Any, size: Any, slant: Any, weight: Any, defaultSize: int = 12) -> None: return None That is to say, it does nothing about getting or setting fonts. -- You received this message becaus

Re: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-15 Thread Thomas Passin
Not quite true: there are a few @font php nodes too. On Wednesday, February 15, 2023 at 1:59:55 PM UTC-5 Thomas Passin wrote: In the standard Leo distro, those @nodes are only used for @language forth, and the Forth colorizer handler uses special bespoke classes. So there may be a bug that

Re: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-15 Thread Thomas Passin
er handler uses special bespoke classes. So there may be a bug that the special Forth code works around but no other language hits. On Wednesday, February 15, 2023 at 10:32:48 AM UTC-5 Edward K. Ream wrote: On Wed, Feb 15, 2023 at 8:09 AM Thomas Passin wrote: @ekr: "I suspect that a

Re: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-15 Thread Thomas Passin
@ekr: "I suspect that adding a node @font rest fonts will suffice." I must be missing the magic way to do this, because none of these changed the font for *@language rest* nodes. I've tried: headline: @font rest body: font-family = Georgia headline: @font rest body: font-family: Georgia head

Re: Body Nodes That Do Not Use A Mono-spaced Font

2023-02-15 Thread Thomas Passin
@ekr: "Leo uses a mono-spaced font for body text. Happy, this statement is not correct. Unless I am mistaken, Leo can already do what you want." My statement was oversimplified - the body font is normally set in the stylesheet and it could be chosen to be a non-monospaced font. -- You receive

Body Nodes That Do Not Use A Mono-spaced Font

2023-02-14 Thread Thomas Passin
Leo uses a mono-spaced font for body text. No doubt this comes from Leo's background as a programming editor/IDE. But many people don't use it like that, or not only like that. They use it for creating documents, notes, or other non-programming uses. For these uses, non-monospaced fonts can

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: 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: Leo package as published on test.pypi.org

2023-02-13 Thread Thomas Passin
Typo in the URL - should be test.pypi.org. As for staleness, it's only for testing the packaging to make sure it will work on PyPi, so maybe the staleness is not too important. On Monday, February 13, 2023 at 11:14:35 AM UTC-5 David Szent-Györgyi wrote: > I was looking for a pypy package of ot

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: 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: Leo's pylint Command Enhanced

2023-02-10 Thread Thomas Passin
On Friday, February 10, 2023 at 9:38:22 AM UTC-5 Edward K. Ream wrote: On Fri, Feb 10, 2023 at 8:04 AM Thomas Passin wrote: The pylint command now can run pylint against a subtree that is not an external file (@file, @clean, ...). Many thanks, Thomas, for this work. For a long time I didn&#

Leo's pylint Command Enhanced

2023-02-10 Thread Thomas Passin
The pylint command now can run pylint against a subtree that is not an external file (@file, @clean, ...). The old behavior is still in place. The command looks up the tree from the focused node to see if that node is in the subtree of an external Python file. If yes, it runs against that fil

Re: GUI For Using Git

2023-02-10 Thread Thomas Passin
They do like to promote themselves. I've only had it installed for two days, so all I know that it seems decent. If I start getting too much spam email, I'll get my email client to deep-six it. I don't use git often enough to really retain commands that are more than simple pulls, etc, and I'

GUI For Using Git

2023-02-09 Thread Thomas Passin
I use a GUI program to help me with using git/GitHub. I'm sure I'm not alone. On Windows I have been used the Windows-only *Git eXtension*s, which works well enough but sometimes I'm not quite sure what some operations are going to do. On Linux I've been using* Git-Cola,* which is simpler, b

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: Python Developer Of The Week

2023-02-06 Thread Thomas Passin
Thanks, guys! On Monday, February 6, 2023 at 7:30:27 PM UTC-5 Félix wrote: > That's pretty cool!! :) > > Félix > > On Monday, February 6, 2023 at 4:16:01 PM UTC-5 Edward K. Ream wrote: > >> On Mon, Feb 6, 2023 at 9:58 AM Thomas Passin wrote: >> >>> I

Re: Pipx

2023-02-06 Thread Thomas Passin
Link for pipx <https://pypa.github.io/pipx/> On Monday, February 6, 2023 at 5:33:37 PM UTC-5 Thomas Passin wrote: > I just tried out pipx, which is a Python install program that wraps pip > such that for each installed package, it creates a separate virtual > environment, ins

Pipx

2023-02-06 Thread Thomas Passin
I just tried out pipx, which is a Python install program that wraps pip such that for each installed package, it creates a separate virtual environment, installs into that, and creates executables to launch each of the entry points. I believe that it installs basically similar to using --edita

Python Developer Of The Week

2023-02-06 Thread Thomas Passin
I gave an email interview to the PyDev Of The Week series. Edward was featured there several years ago so I'm in good company. I'm posting it here because I talk quite a bit about Leo. PyDev Of The Week <https://www.blog.pythonlibrary.org/2023/02/06/pydev-of-the-week-thomas-pass

Command To Run External File

2023-02-05 Thread Thomas Passin
I've been working on a command to run an external file (@file, @clean ...). I think it is ready, and I'd appreciate it if other folks could test it for me. The idea is that you select a node in the external file tree and launch the command. It works on Windows and Linux but not Mac (I need m

Re: Why nits matter

2023-02-05 Thread Thomas Passin
It might be easiest to copy the gnx of the next child node (if there is one), and then go to that gnx after the delete. That way you wouldn't have to worry about positions changing, On Sunday, February 5, 2023 at 4:13:23 PM UTC-5 Félix wrote: > I'll just chime in to say this is not trivial. (a

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: 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: Revised: Info issue #2867 re developer scripts

2023-02-04 Thread Thomas Passin
" There's no need t make the scripts @clean trees. @file with @language batch works well enough (thought I prefer to use "::"" Darn, posted before I was done. That's supposed to read There's no need to make the scripts @clean trees. @file with @language batch works well enough (though I pref

Re: Revised: Info issue #2867 re developer scripts

2023-02-04 Thread Thomas Passin
I use a c:\usr\bin directory to make it more Linux-like. I just couldn't get myself to make a ~\.local\bin directory, though. Maybe I should reconsider... There's no need t make the scripts @clean trees. @file with @language batch works well enough (thought I prefer to use "::" On Saturday,

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

2023-02-04 Thread Thomas Passin
I haven't worked specifically with a Treeview, but I think you need to detect the onClick event (or an onSelect event if there is one) and have that trigger the flashing. Otherwise the selection probably overwrites styling that you added. That's what I do for classic Tk buttons to make them fl

Re: Aha! A better way to study code

2023-02-04 Thread Thomas Passin
I don't see a matching *remove-icon* command, though. On Saturday, February 4, 2023 at 9:45:49 AM UTC-5 Edward K. Ream wrote: > On Sat, Feb 4, 2023 at 6:35 AM jkn wrote: > >> That's cool, thanks. so even now I can do "insert-icon" / (browse to an >> icon) , and have it be added to a node ;-

Re: Organizing modules and their code

2023-02-03 Thread Thomas Passin
On 2/4/2023 12:24 AM, dn via Python-list wrote: The transform is likely dictated by your client's specification. So, another separation. Hence Design 1. There is a strong argument for suggesting that we're going out of our way to imagine problems or future-changes (which may never happen). If

<    6   7   8   9   10   11   12   13   14   15   >