Re: Division-Bug in decimal and mpmath

2024-12-14 Thread Dan Sommers via Python-list
On 2024-12-14 at 12:08:29 +, Mark Bourne via Python-list wrote: > Martin Ruppert wrote: > > Hi, > > > > the division 0.4/7 provides a wrong result. It should give a periodic > > decimal fraction with at most six digits, but it doesn't. > > > > Below is the comparison of the result of decima

Re: shutil.rmtree() fails when used in Fedora (rpm) "mock" environment

2024-10-24 Thread Dan Sommers via Python-list
On 2024-10-24 at 20:54:53 +0100, MRAB via Python-list wrote: > On 2024-10-24 20:21, Left Right wrote: > > > > > The stack is created on line 760 with os.lstat and entries are > > > > > appended > > > > > on lines 677 (os.rmdir), 679 (os.close) and 689 (os.lstat). > > > > > > > > > > 'func' is po

Re: [Tutor] How to stop a specific thread in Python 2.7?

2024-10-11 Thread Dan Ciprus (dciprus) via Python-list
Thank you for the hint ! On Fri, Oct 04, 2024 at 09:17:19AM GMT, Cameron Simpson wrote: On 03Oct2024 22:12, Dan Ciprus (dciprus) wrote: I'd be interested too :-). Untested sketch: def make_thread(target, *a, E=None, **kw): ''' Make a new Event E and T

Re: [Tutor] How to stop a specific thread in Python 2.7?

2024-10-03 Thread Dan Ciprus (dciprus) via Python-list
/mailman/listinfo/tutor -- https://mail.python.org/mailman/listinfo/python-list -- Dan Ciprus [ curl -L http://git.io/unix ] signature.asc Description: PGP signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-10-01 Thread Dan Sommers via Python-list
On 2024-10-01 at 23:03:01 +0200, Left Right wrote: > > If I recognize the first digit, then I *can* hand that over to an > > external function to accumulate the digits that follow. > > And what is that external function going to do with this information? > The point is you didn't parse anything

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-10-01 Thread Dan Sommers via Python-list
On 2024-09-30 at 21:34:07 +0200, Regarding "Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API," Left Right via Python-list wrote: > > What am I missing? Handwavingly, start with the first digit, and as > > long as the next character is a digit, multipliy th

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-10-01 Thread Dan Sommers via Python-list
On 2024-09-30 at 18:48:02 -0700, Keith Thompson via Python-list wrote: > 2qdxy4rzwzuui...@potatochowder.com writes: > [...] > > In Common Lisp, you can write integers as #nnR[digits], where nn is the > > decimal representation of the base (possibly without a leading zero), > > the # and the R are

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-09-30 Thread Dan Sommers via Python-list
On 2024-10-01 at 09:09:07 +1000, Chris Angelico via Python-list wrote: > On Tue, 1 Oct 2024 at 08:56, Grant Edwards via Python-list > wrote: > > > > On 2024-09-30, Dan Sommers via Python-list wrote: > > > > > In Common Lisp, integers can be written in any inte

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-09-30 Thread Dan Sommers via Python-list
On 2024-10-01 at 04:46:35 +1000, Chris Angelico via Python-list wrote: > On Tue, 1 Oct 2024 at 04:30, Dan Sommers via Python-list > wrote: > > > > But why do I need to start with the least > > significant digit? > > If you start from the most significant, you d

Re: Help with Streaming and Chunk Processing for Large JSON Data (60 GB) from Kenna API

2024-09-30 Thread Dan Sommers via Python-list
On 2024-09-30 at 11:44:50 -0400, Grant Edwards via Python-list wrote: > On 2024-09-30, Left Right via Python-list wrote: > > Whether and to what degree you can stream JSON depends on JSON > > structure. In general, however, JSON cannot be streamed (but commonly > > it can be). > > > > Imagine a

Re: Common objects for CLI commands with Typer

2024-09-23 Thread Dan Sommers via Python-list
On 2024-09-23 at 19:00:10 +0100, Barry Scott wrote: > > On 21 Sep 2024, at 11:40, Dan Sommers via Python-list > > wrote: > But once your code gets big the disciple of using classes helps > maintenance. Code with lots of globals is problematic. Even before your code gets big

Re: Common objects for CLI commands with Typer

2024-09-21 Thread Dan Sommers via Python-list
On 2024-09-21 at 06:38:05 +0100, Barry via Python-list wrote: > > On 20 Sep 2024, at 21:01, Loris Bennett via Python-list > > wrote: > > > > Hi, > > > > Apologies if the following description is to brief - I can expand if no > > one knows what I'm on about, but maybe a short description is e

Re: Is there a better way? [combining f-string, thousands separator, right align]

2024-08-26 Thread Dan Sommers via Python-list
On 2024-08-26 at 20:42:32 +1200, dn via Python-list wrote: > and if we really want to go over-board: > > >>> RIGHT_JUSTIFIED = ">" > >>> THOUSANDS_SEPARATOR = "," > >>> s_format = F"{RIGHT_JUSTIFIED}{S_FIELD_WIDTH}{THOUSANDS_SEPARATOR}" > > or (better) because right-justification is the default

Re: new here

2024-08-21 Thread Dan Sommers via Python-list
On 2024-08-20 at 23:16:48 -0400, AVI GROSS via Python-list wrote: > I do wonder if the people at python.org want multiple forums. There is > also one that sort of tutors people that obviously has an overlapping > but different audience. $ python -m this The Zen of Python, by Tim Peters [...] The

Re: Best use of "open" context manager

2024-07-06 Thread Dan Sommers via Python-list
sed it a little, but I don't know the full depths of your use case and/or requirements. HTH, Dan -- https://mail.python.org/mailman/listinfo/python-list

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

2024-05-29 Thread Dan Sommers via Python-list
On 2024-05-29 at 11:39:14 -0700, HenHanna via Python-list wrote: > On 5/27/2024 1:59 PM, 2qdxy4rzwzuui...@potatochowder.com wrote: > > https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule [...] > Are the Rules 1--9 by Greenspun good too? I don't know; let me look it up. Oh, there it i

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 hardl

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 program

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. -- https://mail.python.org/mailma

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

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 i

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 usefu

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

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

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 fil

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

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

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 c

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 of

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 mine

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

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 examp

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

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

2023-01-19 Thread Dan Kolis
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 a

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
ince its 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... Re

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

2023-01-18 Thread Dan Kolis
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
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 --

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

2023-01-18 Thread Dan Kolis
your 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
x27;s the right way to do 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 notic

Re: Passing information between modules

2022-11-20 Thread Dan Kolis
otless road, Empty as sky, 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
more subsid level 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

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 d

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, > > https://docs.python.org/3/library/stdtypes.

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 following

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 pyth

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 fla

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 only

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 sta

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

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 u

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

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

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

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 [1]Ma

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 everythin

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 ins

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 you

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 no

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 than

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 email

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 thing

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 of

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

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

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 besi

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 test

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

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 = (value.mo

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 formatte

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 ht

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 wa

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 ha

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

  1   2   3   4   5   6   7   8   9   10   >