Formatted Output and Argument Parsing (was: Re: Flubbed it in the second interation through the string: range error... HOW?)

2024-05-29 Thread Dan Sommers via Python-list
On 2024-05-29 at 17:14:51 +1000, Chris Angelico via Python-list wrote: > I wouldn't replace str.format() everywhere, nor would I replace > percent encoding everywhere - but in this case, I think Thomas is > correct. Not because it's 2024 (f-strings were brought in back in > 2015, so they're

Re: Any marginally usable programming language approaches an ill defined barely usable re-implementation of half of Common-Lisp

2024-05-27 Thread Dan Sommers via Python-list
On 2024-05-27 at 12:37:01 -0700, HenHanna via Python-list wrote: > > On 5/27/2024 7:18 AM, Cor wrote: > > Some entity, AKA "B. Pym" , > > wrote this mindboggling stuff: > > (selectively-snipped-or-not-p) > > > > > On 12/16/2023, c...@clsnet.nl wrote: > > > > > > > Any marginally usable

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

2024-05-19 Thread Dan Sommers via Python-list
On 2024-05-19 at 18:13:23 +, Gilmeh Serda via Python-list wrote: > Was there a reason they chose the name Pip? Package Installer for Python https://pip.pypa.io/en/stable/index.html -- https://mail.python.org/mailman/listinfo/python-list

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

2024-05-19 Thread Dan Sommers via Python-list
On 2024-05-19 at 18:13:23 +, Gilmeh Serda via Python-list wrote: > Was there a reason they chose the name Pip? Package Installer for Python https://pip.pypa.io/en/stable/index.html Every time I see PIP, I think Peripheral Interchange Program, but I'm old. --

Re: how to discover what values produced an exception?

2024-05-04 Thread Dan Sommers via Python-list
On 2024-05-03 at 10:56:39 -0300, Johanne Fairchild via Python-list wrote: > How to discover what values produced an exception? Or perhaps---why > doesn't the Python traceback show the values involved in the TypeError? > For instance: > >

Re: Configuring an object via a dictionary

2024-03-20 Thread Dan Sommers via Python-list
On 2024-03-20 at 09:49:54 +0100, Roel Schroeven via Python-list wrote: > You haven't only checked for None! You have rejected *every* falsish value, > even though they may very well be acceptable values. OTOH, only you can answer these questions about your situations. Every application, every

Re: Configuring an object via a dictionary

2024-03-15 Thread Dan Sommers via Python-list
On 2024-03-15 at 15:48:17 -0400, Thomas Passin via Python-list wrote: > [...] And I suppose there is always the possibility that sometime in > the future an "or" clause like that will be changed to return a > Boolean, which one would expect anyway. Not only is the current value is way more

Re: Extract lines from file, add to new files

2024-01-13 Thread Dan Sommers via Python-list
On 2024-01-13 at 11:34:29 +0100, Left Right wrote: > > The Python term, at least colloquially, is "tuple unpacking." That quote is from me. Please do preserve attributions. > Well, why use colloquialism if there's a language specification? Also, > there weren't any tuples used in my example,

Re: Extract lines from file, add to new files

2024-01-12 Thread Dan Sommers via Python-list
On 2024-01-13 at 02:02:39 +0100, Left Right via Python-list wrote: > Actually, after some Web search. I think, based on this: > https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-augtarget > that in Python you call this "augmented assignment target". The term >

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

2023-12-06 Thread Dan Purgert via Python-list
On 2023-12-06, Stefan Ram wrote: > Chris Green writes: >>KEY1: >> a: v1 >> c: v3 >> d: v4 >>KEY2: >> a: v7 >> b: v5 >> d: v6 > > That maps nicely to two directories with three files > (under an application-specific configuration directory). Or an .ini

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

2023-12-06 Thread Dan Sommers via Python-list
On 2023-12-06 at 09:32:02 +, Chris Green via Python-list wrote: > Thomas Passin wrote: [...] > > Just go with an .ini file. Simple, well-supported by the standard > > library. And it gives you key/value pairs. > > > My requirement is *slightly* more complex than just key value pairs, >

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread Dan Sommers via Python-list
On 2023-11-29 at 21:44:01 -0300, Julieta Shem via Python-list wrote: > How would you write this procedure? > > --8<---cut here---start->8--- > def powers_of_2_in(n): > s = 0 > while "I still find factors of 2 in n...": > q, r = divmod(n, 2) > if r

Re: Beep on WIndows 11

2023-11-12 Thread Dan Sommers via Python-list
On 2023-11-11 at 23:44:19 +, Y Y via Python-list wrote: > I am curious and humble to ask: What is the purpose of a BEEP? It's a simple way for a terminal-based program to alert (hence '\a') a user or an operator that their attention is requested or required. See also

Re: Checking if email is valid

2023-11-02 Thread Dan Purgert via Python-list
On 2023-11-02, dn wrote: > On 02/11/2023 19.46, Simon Connah via Python-list wrote: >> [...] >> My goal is to make a simple mailing list platform. I guess I could >> just send email to an address and if it bounces then I can remove it >> from the database. Thing is I'm not sure how close to a real

Re: Question(s)

2023-10-26 Thread Dan Purgert via Python-list
On 2023-10-26, o1bigtenor wrote: > On Wed, Oct 25, 2023 at 10:19 AM Michael Torrie via Python-list > wrote: >> >> On 10/25/23 05:51, o1bigtenor via Python-list wrote: >> > Looks like I have another area to investigate. (grin!) >> > Any suggestions? >> >> Seems to me you're trying to run before you

Re: Question(s)

2023-10-25 Thread Dan Purgert via Python-list
On 2023-10-25, o1bigtenor wrote: > On Wed, Oct 25, 2023 at 7:00 AM Dieter Maurer wrote: >> [...] >> There are several others, >> e.g. "ECLIPSE" can be used for Python development. > > Is 'Eclipse' a Windows oriented IDE? > (Having a hard time finding linux related information on the > website.)

Re: Question(s)

2023-10-25 Thread Dan Purgert via Python-list
On 2023-10-24, o1bigtenor wrote: > On Tue, Oct 24, 2023 at 5:28 PM Rob Cliffe wrote: >> >> There is no general way to prove that a program is "correct". Or even >> whether it will terminate or loop endlessly. >> [...] >> When you come to run your program "for real", and you have to >>

Re: Question(s)

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

Re: Why doc call `__init__` as a method rather than function?

2023-09-15 Thread Dan Sommers via Python-list
On 2023-09-15 at 10:49:10 +, scruel tao via Python-list wrote: > ```python > >>> class A: > ... def __init__(self): > ... pass > ... > >>> A.__init__ > > >>> a = A() > >>> a.__init__ > > > ``` > > On many books and even the official documents, it seems that many authors > prefer to

Re: ANN: A new version (0.5.1) of python-gnupg has been released.

2023-07-22 Thread Dan Sommers via Python-list
On 2023-07-22 at 11:04:35 +, Vinay Sajip via Python-list wrote: > What Changed? > = What changed, indeed. Maybe I'm old, and curmudgeonly, but it would be nice if the body of these annoucement emails (not just this one) contained the name of the program and a one-line summary

TKinter in Python - advanced notions - ok

2023-06-24 Thread Dan Kolis via Python-list
Well, its kind of obvious to make a skeleton, copy it in for some basic functionality and modularly ( is that a word ? ) manage each piece. That ( like your example ) is fine stuff. As a side note, I am sure large, large highly generalised programs are pretty hard to make. One thing I do is

Re: TKinter in Python - advanced notions - reactive

2023-06-23 Thread Dan Kolis via Python-list
it react. Regards, thanks, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: TKinter in Python - advanced notions

2023-06-23 Thread Dan Kolis via Python-list
If you have a problem,. ask a super specific question, here. If I can help, I will, but TKINTER knowledge is pretty spread around. Many others migth jump in, too. Its works, its slightly quirky, has no licencing hangups. X11 makes fine fine programs ! Keep hacking,Dan -- https

TKinter in Python - advanced notions

2023-06-21 Thread Dan Kolis via Python-list
Hi, I've write a huge biotech program ( an IDE for synthetic biology ), and am slowly outgrowing TKINTER. Has anybody out there merged a little bit of TCL direct calls from Python 3.X to get more freedom then TKINTER for just some Windows ? How about bold stories of successes ( yours, not

What is this TEST BANK stuff ?

2023-06-21 Thread Dan Kolis via Python-list
Why do we tolerate this spam ? this seems most likely a way to inject viruses into people's workflow. That wiped out usenet. Ahh without an explaination; ( and it woudl have to be a good one ); what is the purpsoe of this, why is it here ? Can it be eliminated ? Regards, Dan -- https

Tkinter Redo's

2023-05-30 Thread Dan Kolis
On Tuesday, May 30, 2023 at 1:28:04 PM UTC-4, Rob Cliffe wrote: > Thanks to everyone who replied. All replies were constructive, none > were telling me to stop belly-aching. Hi, Dan says: When you get your style ideas sort of frozen, maybe you can poke up a sample here. Aworked e

Re: Python - working with xml/lxml/objectify/schemas, datatypes, and assignments

2023-01-19 Thread Dan Kolis
Editing text intended primarily for machine reading that involves metadata and lower level facts is a horror show. I sort of worked for a company years ago and a smart ass suggested I was making labor for myself by doing changes to a scripting language for db users, maybe a few hours a week.

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

2023-01-19 Thread Dan Kolis
n. And so > on. Dan says: After lots of iterations, I changed one line in a call used to refresh windows from .update() to .update_idle_tasks() Some other dudes were so nice they tested it before that, it worked perfectly on their computers anyway. Now it seems to work 'all the way' too after this

Re: A natural magnet for the craziest TKinter lovers out there

2023-01-19 Thread Dan Kolis
pful ! I seemed to have 'fixed it' by changing one line, really. I used: # Do each thing ..for aWs in workWsL: aWs.update() TO: # Do each thing ..for aWs in workWsL: ....aWs.update_idletasks() Dan says: Thanks a lot ! This helps me visualise this is managed as a proble

A natural magnet for the craziest TKinter lovers out there

2023-01-18 Thread Dan Kolis
a cult thing to love TCL ( or something ) Here is is. Same on two different computers in Python 3.6 and 3.8 Plus I suppose you get to see for sure all your finest fonts as rendered in a real TK thing, not that this changes the worlds so much. Thanks for the advice so far... Regards, Dan

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

2023-01-18 Thread Dan Kolis
of oddities is suspect. I cant really think of any better way to debug it. I see no evidence in WWW searches its a generic problem. So tracing the startup and watching it hop all around is about one of five lesser problem line items. Regs Dan -- https://mail.python.org/mailman/listinfo/python-list

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

2023-01-18 Thread Dan Kolis
Thank you -- https://mail.python.org/mailman/listinfo/python-list

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

2023-01-18 Thread Dan Kolis
> I don't think you've described this. I don't know what you mean here. When I trace it in VSCode the imports seem like they endlessly suspend scanning and go to other ones over and over. Like "Whats this doing ?" -- https://mail.python.org/mailman/listinfo/python-list

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

2023-01-18 Thread Dan Kolis
for extreme uniformity in the names and so on, there utterly uniform, so there not so bad to consider, ( I hope ). I guess I don't full understand what bothers me about the repetition of the imports so much. The tracing of it seems so bizarre, it just seems like its wrong. Regs Dan -- https

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

2023-01-18 Thread Dan Kolis
dialog's are very helpful. Dan -- https://mail.python.org/mailman/listinfo/python-list

Improvement to imports, what is a better way ?

2023-01-18 Thread Dan Kolis
this ? Thank you Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Panoptisch - A way to understand your project's dependencies and find malicious packages

2022-12-09 Thread Dan Kolis
I think it needs a built in viewer or at least a human readable output, or nobody will go through the trouble to use it. Other that that, maybe a pretty good idea, sure -- https://mail.python.org/mailman/listinfo/python-list

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-25 Thread Dan Stromberg
On Sun, Nov 13, 2022 at 4:45 PM DFS wrote: > In code, list.clear is just ignored. > At the terminal, list.clear shows > > > > in code: > x = [1,2,3] > x.clear > print(len(x)) > 3 > > at terminal: > x = [1,2,3] > x.clear > > print(len(x)) > 3 > > > Caused me an hour of frustration before I

Re: Passing information between modules

2022-11-20 Thread Dan Kolis
, with every other sound Not ceasing, calls their ghosts from their abode, there's one for you... a click will get you nine more. but none will help you write a better, more maintainable program. Regards, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Passing information between modules

2022-11-20 Thread Dan Kolis
in naming. ex: gi.IoDot.weights.trucks = whatever gi.IoDot.weights.cars = whatever gi.toastDot.warnings.tooHeavy gi.toastDot.warnings.isOk These can all be any kind of object. So easy I have a very sizable highly generalized program using this and have not found any defect in doing so. Regs Dan

Re: Passing information between modules

2022-11-20 Thread Dan Kolis
It's certainly not an "incredibly bad idea", it is a mildly bad idea however. Why be stuck with maybe's and just text strings ? Functions as "first class operators" and object oriented languages are a natural pair with a bit of heavy thinking. The problem is... there is nobody giving you a 3

Re: Passing information between modules

2022-11-19 Thread Dan Kolis
In a module mostly for this purpose; ( big program means many modules aka files ): -- globalIdeas.py -- # Empty object maker ( M T )

Re: Are these good ideas?

2022-11-14 Thread Dan Stromberg
On Mon, Nov 14, 2022 at 11:33 AM Axy via Python-list wrote: > On 14/11/2022 17:14, Stephen Tucker wrote: > > Hi, > > > > I have two related issues I'd like comments on. > > > > Issue 1 - Global Values > > Your "global variables" module acts exactly as a singleton class. > Which is apparently a

Re: str.replace() when str contains \

2022-10-29 Thread Dan Stromberg
I believe you would do well to print a, before trying to transform it into something else. '\2' is chr(2). '\a' is the bell character, and is unprintable. '\_' is two characters though. On Sat, Oct 29, 2022 at 2:12 PM Bernard LEDRU wrote: > Hello, > >

Re: Typing: Is there a "cast operator"?

2022-10-23 Thread Dan Stromberg
On Sun, Oct 23, 2022 at 2:11 PM Paulo da Silva < p_d_a_s_i_l_v_a...@nonetnoaddress.pt> wrote: > Hello! > > I am in the process of "typing" of some of my scripts. > Using it should help a lot to avoid some errors. > But this is new for me and I'm facing some problems. > > Let's I have the

Re: A trivial question that I don't know - document a function/method

2022-10-22 Thread Dan Stromberg
I don't think there is a "correct" way. It depends somewhat on what tools you're using. I like pydocstyle, which I have hung off of vim with syntastic. pydocstyle checks for https://peps.python.org/pep-0257/ conformance. Also, rather than describe the types of formal parameters to functions in

Re: Find the path of a shell command [POSTPONED]

2022-10-15 Thread Dan Stromberg
On Wed, Oct 12, 2022 at 9:57 PM Cameron Simpson wrote: > On 13Oct2022 03:25, Paulo da Silva > wrote: > >There is another problem involved. The script, works fine except when > >launched by cron! Why? > > Record the script output: > > # record all output > exec >/tmp/script.$$.out 2>&1

Re: Find the path of a shell command

2022-10-14 Thread Dan Stromberg
On Wed, Oct 12, 2022 at 11:13 AM Paulo da Silva < p_d_a_s_i_l_v_a...@nonetnoaddress.pt> wrote: > Hi! > > The simple question: How do I find the full path of a shell command > (linux), i.e. how do I obtain the corresponding of, for example, > "type rm" in command line? > > The reason: > I have

Re: flattening lists

2022-10-11 Thread Dan Stromberg
On Tue, Oct 11, 2022 at 12:48 PM SquidBits _ wrote: > Does anyone else think there should be a flatten () function, which just > turns a multi-dimensional list into a one-dimensional list in the order > it's in. e.g. > > [[1,2,3],[4,5,6,7],[8,9]] becomes [1,2,3,4,5,6,7,8,9]. > > I have had to

Re: for -- else: what was the motivation?

2022-10-07 Thread Dan Stromberg
The else is executed if you don't "break" out of the loop early. It cuts down on boolean flags. On Fri, Oct 7, 2022 at 8:40 PM Axy via Python-list wrote: > Hi there, > > this is rather a philosophical question, but I assume I miss something. > I don't remember I ever used else clause for years

Re: Python 3.9.14

2022-09-16 Thread Dan Stromberg
‪On Wed, Sep 14, 2022 at 6:05 AM ‫אורי‬‎ wrote:‬ > Hi, > > Python 3.9.14 has been released on Sept. 6, 2022. As I can see written on > https://www.python.org/downloads/release/python-3914/: > > According to the release calendar specified in PEP 596, Python 3.9 is now > in the "security fixes

Re: How to replace an instance method?

2022-09-16 Thread Dan Stromberg
On Fri, Sep 16, 2022 at 2:06 PM Ralf M. wrote: > I would like to replace a method of an instance, but don't know how to > do it properly. > You appear to have a good answer, but... are you sure this is a good idea? It'll probably be confusing to future maintainers of this code, and I doubt

Re: Local variable definition in Python list comprehension

2022-09-02 Thread Dan Stromberg
On Thu, Sep 1, 2022 at 9:16 AM Chris Angelico wrote: > On Fri, 2 Sept 2022 at 02:10, James Tsai wrote: > > > > Hello, > > > > I find it very useful if I am allowed to define new local variables in a > list comprehension. For example, I wish to have something like > > [(x, y) for x in range(10)

Re: Coffee

2022-08-29 Thread Dan Stromberg
On Mon, Aug 29, 2022 at 1:10 PM Meredith Montgomery wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > > > |Python's obviously a great tool for all kinds of programming things, > > |and I would say if you're only gonna use one programming > > |language in your live, Python will probably the

Re: subprocess.popen how wait complete open process

2022-08-21 Thread Dan Stromberg
On Sun, Aug 21, 2022 at 2:05 PM Chris Angelico wrote: > On Mon, 22 Aug 2022 at 05:39, simone zambonardi > wrote: > > > > Hi, I am running a program with the punishment subrocess.Popen(...) what > I should do is to stop the script until the launched program is fully open. > How can I do this? I

Re: setup.py + cython == chicken and the egg problem

2022-08-18 Thread Dan Stromberg
On Tue, Aug 16, 2022 at 2:03 PM Dan Stromberg wrote: > Hi folks. > > I'm attempting to package up a python package that uses Cython. > > Rather than build binaries for everything under the sun, I've been > focusing on including the .pyx file and running cython on it

Re: setup.py + cython == chicken and the egg problem

2022-08-17 Thread Dan Stromberg
On Wed, Aug 17, 2022 at 3:05 PM Dan Stromberg wrote: > I commented out those too lines, but I'm still getting errors. They seem >> to stem from: >> $ "/home/dstromberg/venv/pyx-treap-testing/bin/python3", >> ["/home/dstromberg/venv/pyx-treap-testing/bin/pyt

Re: setup.py + cython == chicken and the egg problem

2022-08-17 Thread Dan Stromberg
On Wed, Aug 17, 2022 at 1:58 PM Dan Stromberg wrote: > On Wed, Aug 17, 2022 at 10:20 AM Christian Gollwitzer > wrote: > >> Am 16.08.22 um 23:03 schrieb Dan Stromberg: >> > I'm attempting to package up a python package that uses Cython. >> > >> > Rathe

Re: setup.py + cython == chicken and the egg problem

2022-08-17 Thread Dan Stromberg
On Wed, Aug 17, 2022 at 10:20 AM Christian Gollwitzer wrote: > Am 16.08.22 um 23:03 schrieb Dan Stromberg: > > I'm attempting to package up a python package that uses Cython. > > > > Rather than build binaries for everything under the sun, I've been > focusing > &

Re: not able to use python

2022-08-17 Thread Dan Ciprus (dciprus) via Python-list
Those people keep me on my toes every time I look at such a message :-/. On Wed, Aug 17, 2022 at 12:35:28PM -0500, Igor Korot wrote: Hi, On Wed, Aug 17, 2022 at 12:20 PM i am unable to use python wrote: AND I"M UNABLE TO SEE ANYTHING IN YOUR MESSAGE... THANK YOU. Sent from

Re: setup.py + cython == chicken and the egg problem

2022-08-16 Thread Dan Stromberg
On Tue, Aug 16, 2022 at 2:08 PM Chris Angelico wrote: > On Wed, 17 Aug 2022 at 07:05, Dan Stromberg wrote: > > > > Hi folks. > > > > I'm attempting to package up a python package that uses Cython. > > > > Rather than build binaries for everyth

setup.py + cython == chicken and the egg problem

2022-08-16 Thread Dan Stromberg
Hi folks. I'm attempting to package up a python package that uses Cython. Rather than build binaries for everything under the sun, I've been focusing on including the .pyx file and running cython on it at install time. This requires a C compiler, but I'm OK with that. However, when I try to

Re: Conecting to MySQL

2022-08-09 Thread Dan Ciprus (dciprus) via Python-list
I'm not sure about this but this mailing list does not allow attachments ... On Tue, Aug 09, 2022 at 12:45:33PM -0300, Guilherme Campos wrote: Hi Igor, Accessing mysql-workbench it appeared new error messages when I clicked Server Status. I created my database on MySQL Workbench . Is that

Re: Conecting to MySQL

2022-08-09 Thread Dan Ciprus (dciprus) via Python-list
Yes, exactly that .. I replied from different account and my email was rejected. Just make sure that your mysql is actually running. Depending on your OS, run netstat -an | grep 3306 and this will tell you whether socket is actually in listening mode or not. If it's not, your mysql is either

Re: Parallel(?) programming with python

2022-08-08 Thread Dan Stromberg
Queues are better than lists for concurrency. If you get the right kind, they have implicit locking, making your code simpler and more robust at the same time. CPython threading is mediocre for software systems that have one or more CPU-bound threads, and your FFT might be CPU-bound. Rather

Re: Trying to understand nested loops

2022-08-08 Thread Dan Purgert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 dn wrote: > On 06/08/2022 11.41, avi.e.gr...@gmail.com wrote: >> I wonder if someone is pulling our leg as they are sending from an >> invalid email address of "GB " which is >> a bit sick. > > There are a number of folk who use evidently false

Re: Trying to understand nested loops

2022-08-05 Thread Dan Stromberg
On Fri, Aug 5, 2022 at 12:54 PM Grant Edwards wrote: > In C, this doesn't do what it looks like it's supposed to do. > >if (foo) > do_this(); > and_this(); >then_do_this(); > It's been quite a while since I used C, but with the right compiler flag(s), I think this may be a

Re: Trying to understand nested loops

2022-08-05 Thread Dan Stromberg
On Fri, Aug 5, 2022 at 12:30 PM GB wrote: > On 05/08/2022 08:56, Frank Millman wrote: > > > BTW, there is an indentation error in your original post - line 5 should > > line up with line 4. > > As a Python beginner, I find that Python is annoyingly picky about > indents. And, the significance

Re: Trying to understand nested loops

2022-08-05 Thread Dan Stromberg
On Fri, Aug 5, 2022 at 12:35 AM wrote: > Hello, I’m new to learning python and I stumbled upon a question nested > loops. This is the question below. Can you please how they arrived at 9 as > the answer. Thanks > > var = 0 > for i in range(3): > for j in range(-2,-7,-2): > var += 1 >

Re: Dictionary order?

2022-08-01 Thread Dan Stromberg
On Mon, Aug 1, 2022 at 4:42 PM Dan Stromberg wrote: > > > Yes, but I'm pretty sure that's been true for a LONG time. The hashes >> > for small integers have been themselves for as long as I can remember. >> > But the behaviour of the dictionary, when fed such k

Re: Dictionary order?

2022-08-01 Thread Dan Stromberg
On Mon, Aug 1, 2022 at 3:25 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > 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

Re: Dictionary order?

2022-08-01 Thread Dan Stromberg
On Mon, Aug 1, 2022 at 1:41 PM Dan Stromberg wrote: > On 1.4 through 2.1 I got descending key order. I expected the keys to be > scattered, but they weren't. > I just noticed that 1.4 was ascending order too - so it was closer to 2.2 than 1.5. I guess that's kind of beside the poi

Dictionary order?

2022-08-01 Thread Dan Stromberg
Hi folks. I'm still porting some code from Python 2.7 to 3.10. As part of that, I saw a list being extended with a dict.values(), and thought perhaps it wasn't ordered as intended on Python 2.7, even though the problem would conceivably just disappear on 3.10. So I decided to write a little

Re: script folder is empty

2022-07-18 Thread Dan Stromberg
This is another reason to use: python -m pip ... ...instead of: pip ... (Or many systems want python3 -m pip) HTH On Sun, Jul 17, 2022 at 10:42 PM dn wrote: > On 18/07/2022 16.53, Scott Baer wrote: > > I just installed Python 3.10.5 on a Windows 10 home ( Ver 21H2 OS build > >

Re: Extract the space group generators from Bilbao Crystallographic Server.

2022-07-14 Thread Dan Stromberg
It's good to include what you want to see as output, but it's important to also include what you have as input. It's also good to include what you've coded so far. It's considered good etiquette to give it a try yourself before asking the list. On Thu, Jul 14, 2022 at 1:03 PM hongy...@gmail.com

Re: Subtract n months from datetime

2022-06-21 Thread Dan Stromberg
On Mon, Jun 20, 2022 at 9:45 PM Paul Bryan wrote: > Here's how my code does it: > > > import calendar > > def add_months(value: date, n: int): > """Return a date value with n months added (or subtracted if > negative).""" > year = value.year + (value.month - 1 + n) // 12 > month =

python.org wiki, not allowing me to log in?

2022-06-11 Thread Dan Stromberg
Hi folks. I have a little elbow grease available, so I thought I'd edit https://wiki.python.org/moin/BeginnersGuide/Download ...a little. However, signing in with my google creds by clicking the little Google button, gives me: OpenID discovery failure, not a valid OpenID.

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Dan Stromberg
On Thu, Jun 9, 2022 at 1:52 PM Michael F. Stemper wrote: > On 09/06/2022 12.52, Chris Angelico wrote: > > On Fri, 10 Jun 2022 at 03:44, Dave wrote: > > >> Before I write my own I wondering if anyone knows of a function that > will print a nicely formatted dictionary? > >> > >> By nicely

Re: How to replace characters in a string?

2022-06-08 Thread Dan Stromberg
On Wed, Jun 8, 2022 at 1:11 AM Dave wrote: > I've got two that appear to be identical, but fail to compare. After > getting the ascii encoding I see that they are indeed different, my > question is how can I replace the \u2019m with a regular single quote mark > (or apostrophe)? > Perhaps try

Re: min, max with position

2022-06-04 Thread Dan Stromberg
On Sat, Jun 4, 2022 at 9:07 PM Greg Ewing wrote: > On 5/06/22 10:07 am, dn wrote: > > On 05/06/2022 09.50, Chris Angelico wrote: > > min(enumerate(l), key=lambda x: x[1]) > >> (0, 1.618033) > > > > But, but, but which of the above characters is an 'el' and which a > 'one'??? > > (please have

Re: Question about building Python-3.9.12 on OpenBSD 7.1

2022-06-02 Thread Dan Stromberg
It's been my understanding that there is a fundamental difference between the *BSD's and the Linuxes. The *BSD's have their ports system, that collects deltas against third-party packages to build them on a *BSD. These deltas become part of the ports system. The Linuxes port an application, and

Re: Non-deterministic set ordering

2022-05-15 Thread Dan Stromberg
On Sun, May 15, 2022 at 8:01 PM Rob Cliffe via Python-list < python-list@python.org> wrote: > I was shocked to discover that when repeatedly running the following > program (condensed from a "real" program) under Python 3.8.3 > > for p in { ('x','y'), ('y','x') }: > print(p) > > the output

Mypy alternatives

2022-05-14 Thread Dan Stromberg
Hello people. I've used Mypy and liked it in combination with MonkeyType. I've heard there are alternatives to Mypy that are faster, and I'm looking at using something like this on a 457,000 line project. Are there equivalents to MonkeyType that will work with these alternatives to Mypy? And

"py" command for Linux and Mac?

2022-05-12 Thread Dan Stromberg
Hi folks. I heard there's a Windows-like "py" command for Linux (and Mac?). I'm finally getting to porting a particular project's Python 2.7 code to 3.x, and one of the first steps will probably be changing a lot of "python2 script.py" to use #!/usr/bin/env python2 and chmod +x. Then we can

Re: [Python-ideas] Re: New Tool Proposal

2022-05-10 Thread Dan Stromberg
On Tue, May 10, 2022 at 3:15 AM Chris Angelico wrote: > > It is often the case that developer write Code in Python and then > convert to a C extension module for performance regions. > > > > A C extension module has a lot of boiler plate code - for instance the > Structures required for each

Re: tail

2022-05-07 Thread Dan Stromberg
I believe I'd do something like: #!/usr/local/cpython-3.10/bin/python3 """ Output the last 10 lines of a potentially-huge file. O(n). But technically so is scanning backward from the EOF. It'd be faster to use a dict, but this has the advantage of working for huge num_lines. """ import

Re: Python/New/Learn

2022-05-04 Thread Dan Stromberg
If you already know at least one other imperative programming language: https://wiki.python.org/moin/BeginnersGuide/Programmers If you don't: https://wiki.python.org/moin/BeginnersGuide/NonProgrammers On Wed, May 4, 2022 at 7:49 PM Patrick 0511 wrote: > Hello, I'm completely new here and

Re: new sorting algorithm

2022-05-02 Thread Dan Stromberg
On Mon, May 2, 2022 at 2:25 AM jan via Python-list wrote: > Hi, > > > The median-of-three partitioning technique makes that work reasonably > well, so it won't be pathologically slow > > Just to be clear because I've wondered but haven't looked into it, we > know naive quicksorting of

Re: new sorting algorithm

2022-05-01 Thread Dan Stromberg
On Sun, May 1, 2022 at 1:44 PM Chris Angelico wrote: > On Mon, 2 May 2022 at 06:43, Dan Stromberg wrote: > > On Sun, May 1, 2022 at 11:10 AM Chris Angelico wrote: > >> > >> On Mon, 2 May 2022 at 01:53, Nas Bayedil wrote: > >> > We believe that using this

Re: tail

2022-05-01 Thread Dan Stromberg
On Sun, May 1, 2022 at 3:19 PM Cameron Simpson wrote: > On 01May2022 18:55, Marco Sulla wrote: > >Something like this is OK? > Scanning backward for a byte == 10 in ASCII or ISO-8859 seems fine. But what about Unicode? Are all 10 bytes newlines in Unicode encodings? If not, and you have a

Re: new sorting algorithm

2022-05-01 Thread Dan Stromberg
This probably should start out as a module on Pypi. Is the sorting stable? Python guarantees that. On Sun, May 1, 2022 at 8:53 AM Nas Bayedil wrote: > *Dear, Sir/Madam* > > > Let me first tell you briefly who we are and where we are from, what we do. > > My name is Nas (full name Nasipa

Re: logging library python

2022-04-27 Thread Dan Stromberg
You probably want getLogger(__name__) ...or something close to it. ‪On Wed, Apr 27, 2022 at 12:58 PM ‫תמר ווסה‬‎ wrote:‬ > hello, > we have many scripts of one project. what is the right way to define the > logger to all scripts? we tried to create class that define the logger >

Re: Style for docstring

2022-04-23 Thread Dan Stromberg
On Fri, Apr 22, 2022 at 12:56 PM Michael F. Stemper < michael.stem...@gmail.com> wrote: > I'm writing a function that is nearly self-documenting by its name, > but still want to give it a docstring. Which of these would be > best from a stylistic point of view: > > >Tells caller whether or

Re: Why no list as dict key?

2022-04-20 Thread Dan Stromberg
On Wed, Apr 20, 2022 at 7:23 PM Abdur-Rahmaan Janhangeer < arj.pyt...@gmail.com> 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. > If you need mutable keys, you /might/ create a dict-like-object using

Re: Python app on a Mac

2022-04-15 Thread Dan Stromberg
On Fri, Apr 15, 2022 at 11:43 AM Alan Gauld wrote: > I've just migrated from a Linux PC to a Mac mini running Monterey. > I'm using a Mac for work lately. I miss Linux. I feel like MacOS isn't nearly as good at multimonitor setups as Cinnamon. Does anyone know how to launch a Python program

Re: Comparing sequences with range objects

2022-04-10 Thread Dan Stromberg
a bloom filter. EG: https://pypi.org/project/drs-bloom-filter/ On Sun, Apr 10, 2022 at 5:31 PM Dan Stromberg wrote: > > It sounds a little like you're looking for interval arithmetic. > > Maybe https://pypi.org/project/python-intervals/1.5.3/ ? > > On Thu, Apr 7, 2022 at 4:19 AM An

Re: Comparing sequences with range objects

2022-04-10 Thread Dan Stromberg
It sounds a little like you're looking for interval arithmetic. Maybe https://pypi.org/project/python-intervals/1.5.3/ ? On Thu, Apr 7, 2022 at 4:19 AM Antoon Pardon wrote: > I am working with a list of data from which I have to weed out duplicates. > At the moment I keep for each entry a

Re: The Cython compiler is 20 years old today !

2022-04-04 Thread Dan Stromberg
On Mon, Apr 4, 2022 at 7:42 AM Stefan Behnel wrote: > Dear Python community, > > it's now 20 years since Greg Ewing posted his first announcement of Pyrex, > the tool that is now known and used under the name Cython. > > https://mail.python.org/pipermail/python-list/2002-April/126661.html >

Re: Sharing part of a function

2022-04-03 Thread Dan Stromberg
On Sun, Apr 3, 2022 at 2:46 PM Cecil Westerhof via Python-list < python-list@python.org> wrote: > Betty Hollinshead writes: > > > "Memoising" is the answer -- see "Python Algorithms" by Magnus Lie > Hetland. > > In the mean time, here a simplified version of "memoising" using a dict. > > This

Re: Exchange OWA using Python?

2022-03-31 Thread Dan Ciprus (dciprus) via Python-list
Yes, this ... I've been using this successfully for years and it obviously has its sad parts but it works pretty well overall. From: Python-list on behalf of Christian Gollwitzer Sent: Thursday, March 31, 2022 3:22 PM To: python-list@python.org

  1   2   3   4   5   6   7   8   9   10   >