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

2022-10-12 Thread Peter J. Holzer
> > as taking a test: do easy and quick things first and boring and > > difficult ones later. > > Yes, but in that case you have a very long indented "else" block, If you return you don't have to indent the rest. hp -- _ | Peter J. Holzer

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
h a much simpler grammar. I very much doubt that. Python doesn't have a particularly complicated grammar, and C certainly doesn't have a particularly simple one. The argument that it's impossible in Python (unlike any other language), because Python is oh so special doesn't hold

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
On 2022-10-13 11:23:40 +1100, Chris Angelico wrote: > On Thu, 13 Oct 2022 at 11:19, Peter J. Holzer wrote: > > On 2022-10-11 09:47:52 +1100, Chris Angelico wrote: > > > On Tue, 11 Oct 2022 at 09:18, Cameron Simpson wrote: > > > > > > > Consider: > > &

Re: What to use for finding as many syntax errors as possible.

2022-10-12 Thread Peter J. Holzer
o recover from errors. So since every sequence of bytes results in a well-defined DOM tree you might argue (a bit tongue in cheek) that there are no syntax errors in HTML5. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h.

Re: What might suddenly provoke this poplib error?

2022-10-13 Thread Peter J. Holzer
P server. > if so there's not much I can do about it as it's my hosting provider's > mail server. You can call you hosting provider and ask them to fix the problem. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: What might suddenly provoke this poplib error?

2022-10-14 Thread Peter J. Holzer
olute assertions like this with a grain of salt. There are always misleading error messages, weird edge cases, etc. But consider those only after ruling out everything else. [2] What may be obvious to one person is of course not necessarily obvious to another. -- _ | Peter J. Holz

Re: Find the path of a shell command

2022-10-14 Thread Peter J. Holzer
most reliable) way to find out the environment a cronjob has is to write a cronjob which just dumps the environment. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creat

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

2022-10-16 Thread Peter J. Holzer
p further and dissociate the program from its linear text representation? Add footnotes, different views, hyperlinks, format mathematical expressions like formulas, etc. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp

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

2022-10-16 Thread Peter J. Holzer
own long before systemd. Anyway he doesn't have to restart cron to add a cron-job (nor for any other reason during normal operation), so what happens if you manually restart cron is almost certainly irrelevant for the OP. hp -- _ | Peter J. Holzer| Story must make more s

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

2022-10-16 Thread Peter J. Holzer
On 2022-10-16 19:52:47 +0200, Antoon Pardon wrote: > Op 16/10/2022 om 19:01 schreef Peter J. Holzer: > > On 2022-10-16 12:17:39 +0200, Antoon Pardon wrote: > > > Op 16/10/2022 om 00:50 schreefavi.e.gr...@gmail.com: > > > > That might not easily solve this prob

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

2022-10-18 Thread Peter J. Holzer
want it to integrate with a lot of other infrastructure. So that alone might make it a non-starter, even if it was really good (which realistically early iterations wouldn't be). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

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

2022-10-22 Thread Peter J. Holzer
On 2022-10-19 12:10:52 +1100, Chris Angelico wrote: > On Wed, 19 Oct 2022 at 12:01, Peter J. Holzer wrote: > > On 2022-10-17 09:25:00 +0200, Karsten Hilbert wrote: > > > http://literateprogramming.com/ > > > > Right. That's one of the inspirations for my commen

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

2022-10-22 Thread Peter J. Holzer
On 2022-10-22 15:04:58 +0200, Peter J. Holzer wrote: > On 2022-10-19 12:10:52 +1100, Chris Angelico wrote: > > On Wed, 19 Oct 2022 at 12:01, Peter J. Holzer wrote: > > > On 2022-10-17 09:25:00 +0200, Karsten Hilbert wrote: > > > > http://literateprogramming.com/ &g

Re: need help

2022-10-24 Thread Peter J. Holzer
orts TLS and the client can then send a STARTTLS command to start a TLS session. If you want to start the connection with TLS, you can (usually) use port 465. Like 587, this is only intended for mail submission, not mail transport. hp -- _ | Peter J. Holzer| Story m

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Peter J. Holzer
-formed and contains a number of li elements at the same level directly below the ol element, not lots of nested li elements. The end tag of the li element is optional (except in XHTML) and li elements don't nest. hp -- _ | Peter J. Holzer| Story must make more sense than rea

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Peter J. Holzer
On 2022-10-24 12:32:11 +0200, Peter J. Holzer wrote: > Ron has already noted that the lxml and html5 parser do the right thing, ^^^ Oops, sorry. That was Roel. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | |

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Peter J. Holzer
On 2022-10-24 21:56:13 +1100, Chris Angelico wrote: > On Mon, 24 Oct 2022 at 21:33, Peter J. Holzer wrote: > > Ron has already noted that the lxml and html5 parser do the right thing, > > so just for the record: > > > > The HTML fragment above is well-formed

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Peter J. Holzer
On 2022-10-25 03:09:33 +1100, Chris Angelico wrote: > On Tue, 25 Oct 2022 at 02:45, Jon Ribbens via Python-list > wrote: > > On 2022-10-24, Chris Angelico wrote: > > > On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote: > > >> Yes, I got that. What I wanted to

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Peter J. Holzer
On 2022-10-25 06:56:58 +1100, Chris Angelico wrote: > On Tue, 25 Oct 2022 at 04:22, Peter J. Holzer wrote: > > There may be several reasons: > > > > * Historically, some browsers differed in which end tags were actually > > optional. Since (AFAIK) no mainstream brow

Re: A typing question

2022-10-30 Thread Peter J. Holzer
#v+ #!/usr/bin/python3 class Foos: Foos = [1, 2, 3] f = Foos() print(f.Foos) #v- This works and I see no reason why it shouldn't work. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

Re: Fwd: A typing question

2022-10-30 Thread Peter J. Holzer
is inferred that's not the same as «Optional[it's type]», or is it? If it's referring to the global symbol «Foos» (i.e. the class defined later) that hasn't been defined yet, so it shouldn't work (or alternatively, if forward references are allowed it should alw

Re: Fwd: A typing question

2022-10-30 Thread Peter J. Holzer
On 2022-10-30 09:23:27 -0400, Thomas Passin wrote: > On 10/30/2022 6:26 AM, Peter J. Holzer wrote: > > On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote: > > > The funny thing is that if I replace foos by Foos it works because it gets > > > known by

Re: Fwd: A typing question

2022-10-31 Thread Peter J. Holzer
On 2022-10-30 11:26:56 +0100, Peter J. Holzer wrote: > On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote: > > The funny thing is that if I replace foos by Foos it works because it gets > > known by the initial initialization :-) ! > > > >

Re: Fwd: A typing question

2022-10-31 Thread Peter J. Holzer
On 2022-10-30 20:43:23 +0100, Peter Otten wrote: > On 30/10/2022 14:37, Peter J. Holzer wrote: > > On 2022-10-30 09:23:27 -0400, Thomas Passin wrote: > > > On 10/30/2022 6:26 AM, Peter J. Holzer wrote: > > > > On 2022-10-29 23:59:44 +0100, Paulo da Silva wrote: > &

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

2022-11-05 Thread Peter J. Holzer
On 2022-10-22 15:04:58 +0200, Peter J. Holzer wrote: > On 2022-10-19 12:10:52 +1100, Chris Angelico wrote: > > On Wed, 19 Oct 2022 at 12:01, Peter J. Holzer wrote: > > > On 2022-10-17 09:25:00 +0200, Karsten Hilbert wrote: > > > > http://literateprogramming.com/ &g

Re: How to manage python shebang on mixed systems?

2022-11-09 Thread Peter J. Holzer
rd unix utilities" may be missing, too. For example on an embedded system there might only be the bare minimum to run the application. I even had a redhat system once which didn't have grep installed.) (Personally I avoid using env: I don't want my scripts to depe

Re: String to Float, without introducing errors

2022-12-17 Thread Peter J. Holzer
e other people posting in this thread I don't think float is the wrong type for the job. It might be, but you haven't given enough details to tell whether the inevitable rounding error matters or not. In my experience in almost all cases where people think it matters it really doesn&

Re: String to Float, without introducing errors

2022-12-17 Thread Peter J. Holzer
On 2022-12-17 21:45:06 +0100, Paul St George wrote: > It was the rounding rounding error that I needed to avoid (as Peter J. > Holzer suggested). The use of decimal solved it and just in time. I > was about to truncate the number, get each of the characters from the > string mantissa,

Re: Single line if statement with a continue

2022-12-19 Thread Peter J. Holzer
hand for “one or more lines of code which do something with `thing`”. So there is nothing after it because it is included in it. That said, the "fail and bail" technique is often more readable than putting the main incode inside of an if - especially if that code is long and/or i

Re: String to Float, without introducing errors

2022-12-19 Thread Peter J. Holzer
d by the decimal to float conversion was unacceptable, showing IMHO a fundamental misunderstanding of the numbers they are working with. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles

Re: String to Float, without introducing errors

2022-12-19 Thread Peter J. Holzer
On 2022-12-19 15:14:14 +, MRAB wrote: > On 2022-12-19 14:10, Peter J. Holzer wrote: > > He also interpreted the notation "6.67430(15)E-11" wrong. The > > digits in parentheses represent the uncertainty in the same number of > > last digits. So "6.674

Re: Installation hell

2022-12-19 Thread Peter J. Holzer
st > -V:3.10 *Python 3.10 (64-bit) > -V:3.9 Python 3.9 (64-bit) > -V:3.7 Python 3.7 (64-bit) > -V:2.7 But that works only for Python. Shell expansion works for any command. If you use Linux, learn how to use your shell (and maybe learn different shells -

Re: Installation hell

2022-12-19 Thread Peter J. Holzer
On 2022-12-20 04:15:07 +1100, Chris Angelico wrote: > On Tue, 20 Dec 2022 at 03:56, Peter J. Holzer wrote: > > It is however, quite noticable that almost everyone who asks a question > > about their Python installation on this list is using Windows. I don't > > think

Re: pygame.midi input/output not working

2022-12-22 Thread Peter J. Holzer
bility we haven't solved yet". Does anybody know what the issue is? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at

Re: Possible re bug when using ".*"

2023-01-01 Thread Peter J. Holzer
#x27;s not a bug, it's a change in behaviour to bring it more into line with > other regex implementations in other languages. Interesting. Perl does indeed behave that way, too. Never noticed that in 28 years of using it. hp -- _ | Peter J. Holzer| Story must make

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

2023-01-04 Thread Peter J. Holzer
xactly which one you're writing to, just flush. I don't think fsync() will have an effect on an FD connected to a terminal (or a pipe or a socket). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

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

2023-01-04 Thread Peter J. Holzer
writing to stderr, and even that can log to any stream - just pass it as an argument. If none of existing handlers does what you want you can always write your own. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | |

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

2023-01-05 Thread Peter J. Holzer
sort of. That is all log messages go to stderr, but not all log levels are logged. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ |

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

2023-01-05 Thread Peter J. Holzer
s can > be answered: "They didn't". Which is almost exactly what I wrote in <20230104162154.uzljittbs6xwt...@hjp.at> ;-) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Cha

Re: Recommendations in terms of threading, multi-threading and/or asynchronous processes/programming? - Sent Mail - Mozilla Thunderbird

2023-01-06 Thread Peter J. Holzer
nd what the constraints and requirements are and is completely impossible to answer in the abstract. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http

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

2023-01-06 Thread Peter J. Holzer
nd how it > works. It probably helps to have worked with log4j before that. The structure is very similar, although I find Python logging easier to use (but then I never did much Java programming so that's probably just a matter of familiarity. hp PS: The TimeoutSwitchingFileHandler mentio

Re: Recommendations in terms of threading, multi-threading and/or asynchronous processes/programming? - Sent Mail - Mozilla Thunderbird

2023-01-08 Thread Peter J. Holzer
lest to look into. I agree with that assessment. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.

Re: To clarify how Python handles two equal objects

2023-01-11 Thread Peter J. Holzer
". Or we can even use the P-word. And since we know that variables in Python can only contain references and never values, we can abbreviate "a reference to an object" as "an object" in most contexts. hp -- _ | Peter J. Holzer| Story must make more sense than re

Re: To clarify how Python handles two equal objects

2023-01-13 Thread Peter J. Holzer
ointer than to move an entire array if it’s > possible, but special care must be taken.  I still don't understand what you mean by that. hp [1] Not quite true. The run-time system must keep track of the variables, so there likely is a pointer to q somewhere. But it

Re: The Zen of D.E.K.

2023-01-13 Thread Peter J. Holzer
ncy (as opposed to developer-time efficiency), Python might not be your language of choice at least for the part where efficiency is crucial. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles

Re: Fast lookup of bulky "table"

2023-01-15 Thread Peter J. Holzer
t to actually measure performance, and a good profiler helps very much in identifying hot spots. Unfortunately until recently Python was a bit deficient in this area, but [Scalene](https://pypi.org/project/scalene/) looks promising. hp -- _ | Peter J. Holzer| Story must make mor

Re: Fast lookup of bulky "table"

2023-01-15 Thread Peter J. Holzer
On 2023-01-15 10:38:22 -0500, Thomas Passin wrote: > On 1/15/2023 6:14 AM, Peter J. Holzer wrote: > > On 2023-01-14 23:26:27 -0500, Dino wrote: > > > Anyway, my Flask service initializes by loading a big "table" of 100k rows > > > and 40 columns or

Re: Fast lookup of bulky "table"

2023-01-16 Thread Peter J. Holzer
icense. I don't see where a view would help here - but maybe you are thinking of a more complex database than you describe. > Some programmers don't realise that SQL can also be used for calculations, > eg the eponymous COUNT(), which saves (CPU-time and coding-effort) over > post

Re: Fast lookup of bulky "table"

2023-01-16 Thread Peter J. Holzer
t becomes more and more pronounced the farther the database is from the client. For complicated queries the parsing and planning overhead can also become significant. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h.

Re: IDLE "Codepage" Switching?

2023-01-18 Thread Peter J. Holzer
t; the console isn't mentioned, but there's no reason it should have glyphs for > any random unicode character. Also note that the characters between 128 (U+0080) and 159 (U+009F) inclusive aren't printable characters. They are control characters. hp -- _ | Pete

Re: IDLE "Codepage" Switching?

2023-01-18 Thread Peter J. Holzer
t; > > > > > > print mylongstr > > 1, 2, 3, 4, 5, 6, 7, 8, 9, > > 10, 11, 12, > > 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, > > 31, 32, ! 33, " 34, # 35, $ 36, % 37, & 38, ' 39, ( 40, ) 41, * 42, + 43, > &

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

2023-01-22 Thread Peter J. Holzer
ast too incomplete to be useful. It handles only single letters as operands and treats everything else (except parentheses) as an operator, handling only +, -, *, / and ^ correctly (actually, ^ is typically right associative, so that's arguably wrong, too). hp -- _ | Peter J. Holzer

Re: HTTP server benchmarking/load testing in Python

2023-01-25 Thread Peter J. Holzer
nto a place with better airflow. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Descr

Re: Evaluation of variable as f-string

2023-01-28 Thread Peter J. Holzer
otice the error message; it ^^^ > > says that the key 'y' does not exist. [...] > > In [1]: x = { "y": "z" } > > In [2]: s = "-> {x[y]}" > > In [3]: print(s.for

Re: Evaluation of variable as f-string

2023-01-28 Thread Peter J. Holzer
you need to implement enough of a Python parser/interpreter to cover the cases you are interested in. The latter might be an interesting exercise, but I would suggest looking at existing template engines like Jinja2 for production purposes. hp -- _ | Peter J. Holzer

Re: Evaluation of variable as f-string

2023-01-28 Thread Peter J. Holzer
: > > >>> s = "{\"x\" * 4}" > >>> eval("f'" + s + "'") > '' That's exactly the result I expected. What did you expect? hp -- _ | Peter J. Holzer| Story must make more sense than

Usenet vs. Mailing-list (was: evaluation question)

2023-01-28 Thread Peter J. Holzer
ailing list, but nothing posted to the group via > NNTP get send on the mailing list. This is wrong. I did get Muttley's any your postings via the mailing-list. (I also get Stefan Ram's postings despite his "no distribution outside of Usenet" header). hp -- _ |

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

2023-01-29 Thread Peter J. Holzer
ch later) edition, wennn "--" was already really common. But POSIX did lead the way in some cases and it might have been the case here, too. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |

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

2023-01-29 Thread Peter J. Holzer
ork as designed. But since you are probably the only person who will have to read your code in the future that's not our problem. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Char

To gateway or not to gateway a specific person (was: Evaluation of variable as f-string)

2023-01-29 Thread Peter J. Holzer
ng lists that you don't want your messages to > be seen on them? He's Stefan Ram :-). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ |

Re: Usenet vs. Mailing-list

2023-01-29 Thread Peter J. Holzer
e). I have to admit that I'm sometimes guilty of this behaviour, too. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ |

Re: Evaluation of variable as f-string

2023-01-29 Thread Peter J. Holzer
n > *arbitrary* dictionary x and a string s As I wrote before: An f-string isn't a string. It's a grammatical construct. So you want to execute Python code which is what eval and exec do. hp -- _ | Peter J. Holzer| Story must make more sense than r

Re: evaluation question

2023-02-01 Thread Peter J. Holzer
On 2023-02-01 09:00:39 -, mutt...@dastardlyhq.com wrote: > Its not evolution, its revolution. Evolution retains old functionality. Tell a penguin that it can fly :-) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | |

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

2023-02-05 Thread Peter J. Holzer
-mail can be anything or not be configured at all - so it might not be the best choice. > Otherwise you haven't said what part of the process you need help with. Yeah, that was the reason I didn't reply to the original mail. I simply couldn't figure out where the problem was.

Re: Question about logging.config.dictConfig

2023-02-07 Thread Peter J. Holzer
t; 'fmt': '%(asctime)s %(levelname)-7s %(name)s %(funcName)s > %(message)s' 'format' > } > }, [...] > } > logging.config.dictConfig(config) > > When I run uselog.py it prints

Re: Comparing caching strategies

2023-02-17 Thread Peter J. Holzer
having said that, there may well be non-integer data that can be > mapped into and out of integers. As an example, airports or radio > stations have names like LAX or WPIX. If you limit yourself to ASCII > letters then every one of them can be stored as a 32-bit integer, > perhaps with some

Re: Precision Tail-off?

2023-02-17 Thread Peter J. Holzer
al in binary, Be careful: "Rational" and "irrational" have a standard meaning in mathematics and it's independent of base. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Char

Re: Precision Tail-off?

2023-02-17 Thread Peter J. Holzer
point". hp [1] It's really unfortunate that the point which separates the integer and the fractional part of a number is called a "decimal point" in English. Makes it hard to talk about non-integer numbers in other bases. -- _ | Peter

Re: Precision Tail-off?

2023-02-17 Thread Peter J. Holzer
any current manufacturers. Doesn't IBM any more? Their POWER processors used to implement decimal FP (starting with POWER8, if I remember correctly). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

Re: Comparing caching strategies

2023-02-18 Thread Peter J. Holzer
27;t care what they need it for. The thought was > about whether something that does not start as an integer can be uniquely > mapped into and out of integers of size 32 bits. That's what confused me. You seemed to concentrate on the "map things to integers" part which has been

Re: Precision Tail-off?

2023-02-18 Thread Peter J. Holzer
e to think of it, it doesn't even have a a y**x operation - just some simpler operations which can be used to implement it. GCC doesn't inline pow(y, x) on x86/64 - it just calls the library function. hp -- _ | Peter J. Holzer| Story must make more sense than reality

Re: Comparing caching strategies

2023-02-18 Thread Peter J. Holzer
ess > patterns. Yes, Roaring Bitmaps are somewhat similar. Judy arrays are more versatile (they support more data types) and in many ways more sophisticated, despite being 10+ years older. OTOH Roaring Bitmaps are a lot simpler which may have contributed to their popularity. hp --

Re: File write, weird behaviour

2023-02-19 Thread Peter J. Holzer
tent if you try this. You can only add at the end of the file. If you want to insert something, you have to rewrite everything from that position. (So typically, for small files you wouldn't update a file in place, you would just replace it completely. For large data sets which need to be updated you w

Re: File write, weird behaviour

2023-02-19 Thread Peter J. Holzer
close() might result in the arguments of f.write() not being completely > written to the disk, even if the program exits successfully." He does call file.close(): > > > file.close() so that doesn't seem relevant. hp -- _ | Peter J. Holzer| Story must

Re: semi colonic

2023-02-24 Thread Peter J. Holzer
On 2023-02-23 15:56:54 -0500, avi.e.gr...@gmail.com wrote: > I am not sure it is fair to blame JSON for a design choice. We can't blame JSON (it has no agency), but as you say, it it was a choice. And we can absolutely blame Doug for making that choice! hp -- _ | Peter J

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

2023-02-24 Thread Peter J. Holzer
in f | return (a + b) * (c + d) | ^ | TypeError: can only concatenate str (not "int") to str would tell me that (c + d) caused the problem and therefore that c must be a str which it obviously shouldn't be. hp -- _ | Peter J. Holzer| St

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

2023-02-24 Thread Peter J. Holzer
, Yup. That is possible and has happened to me several times - of course always in a situation where I really needed that output ... hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles St

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

2023-02-24 Thread Peter J. Holzer
ssert 3 == 2 = 1 failed in 0.09s ===== hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Cr

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

2023-02-24 Thread Peter J. Holzer
incomplete code - I didn't bother to implement multiple observations) and assert(header[0] == "Monat (MM)") (the code below is sloppy. Instead of fixing it I just made the original programmer's assumptions explicit) and of course assert False (this point should never

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

2023-02-24 Thread Peter J. Holzer
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: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-25 Thread Peter J. Holzer
On 2023-02-25 09:10:06 -0500, Thomas Passin wrote: > On 2/25/2023 1:13 AM, Peter J. Holzer wrote: > > On 2023-02-24 18:19:52 -0500, Thomas Passin wrote: > > > Sometimes you can use a second parameter to assert if you know what kind > > > of > > > error to

Re: Is there a more efficient threading lock?

2023-02-25 Thread Peter J. Holzer
ep if it can't get the lock right away. (Of course if it does get the lock, it will return immediately which may use a lot of CPU if you are calling it a lot.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...

Re: Is there a more efficient threading lock?

2023-02-25 Thread Peter J. Holzer
he application using py-spy, that with statement is > consuming huge amounts of CPU. Another thought: How accurate is py-spy? Is it possible that it assigns time actually spent in phrases = TextBlob(text, np_extractor=EXTRACTOR).noun_phrases to with BLOB_LOCK: ? hp -- _ | P

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

2023-02-25 Thread Peter J. Holzer
tter. For example, in C on Linux a failed assertion causes a core dump. So you can inspect the complete state of the program. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, &q

Re: How to escape strings for re.finditer?

2023-02-28 Thread Peter J. Holzer
ails to the end. The long lines and the triple-spaced paragraphs make it just too uncomfortable. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | htt

Cryptic software announcements (was: ANN: DIPY 1.6.0)

2023-02-28 Thread Peter J. Holzer
ood idea if software announcements would include a single paragraph (or maybe just a single sentence) summarizing what the software is and does. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Ch

Re: How to escape strings for re.finditer?

2023-02-28 Thread Peter J. Holzer
On 2023-03-01 01:01:42 +0100, Peter J. Holzer wrote: > On 2023-02-28 15:25:05 -0500, avi.e.gr...@gmail.com wrote: > > It happens to be easy for me to fix but I sometimes see garbled code I > > then simply ignore. > > Truth to be told, that's one reason why I rarely re

Re: How to escape strings for re.finditer?

2023-03-02 Thread Peter J. Holzer
On 2023-03-01 01:01:42 +0100, Peter J. Holzer wrote: > On 2023-02-28 15:25:05 -0500, avi.e.gr...@gmail.com wrote: > > I had no doubt the code you ran was indented properly or it would not work. > > > > I am merely letting you know that somewhere in the process of copyin

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

2023-03-03 Thread Peter J. Holzer
language will often write code which is correct but un-idiomatic, and you can often guess which language they come from (they are "writing FORTRAN in Python"). Also quite similar to natural languages where you can guess the native language of an L2 speaker by their accent and phrasing.

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

2023-03-04 Thread Peter J. Holzer
ot;C-nic" (nice pun, btw) or "Perlish" code. The Python community may be unique in having invented an adjective for that. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles S

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

2023-03-07 Thread Peter J. Holzer
;, the response to the first query might arrive after the response to the second query and you don't want to display "mansion" if the user already typed "mas".) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

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

2023-03-08 Thread Peter J. Holzer
ow long that list can become. If it's 200 matches - sure, send them all, even if the client will display only 10 of them. Probably even for 2000. But if you might get 20 million matches you surely don't want to send them all to the client. hp -- _ | Peter J.

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

2023-03-14 Thread Peter J. Holzer
oesn't. You may want to try PyPy if your code uses tight loops like that. Or alternatively it may be possible to use numpy to do these operations. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

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

2023-03-18 Thread Peter J. Holzer
ct) with a traditional desktop GUI for 20 years) so the presence or absence of a GUI builder isn't an essential criterion on whether something is or is not an IDE. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | |

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

2023-03-18 Thread Peter J. Holzer
um2(): > return sum(range(100)) Here you already have the numbers you want to add. The OP needed to compute those numbers first. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- C

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

2023-03-18 Thread Peter J. Holzer
On 2023-03-18 16:06:49 +, Alan Gauld wrote: > On 18/03/2023 12:15, Peter J. Holzer wrote: > >> I think you might be meaning TurboPascal, Delphi's forerunner. It just > >> had a compiler and text editor. > > > > I'd still classify Turbo Pascal as an I

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Peter J. Holzer
f.choose_method will be the choose_method from UrnaryConstraint. If you call it on an object of class BinaryConstraint, then self.choose_method will be the choose_method from BinaryConstraint. hp PS: Pretty sure there's one "r" too many in UrnaryConstraint. -- _ | Pe

Re: How does a method of a subclass become a method of the base class?

2023-03-27 Thread Peter J. Holzer
e statement it will create a new object of class EqualityConstraint and immediately discard it. That may have some useful side effect (for example the object may add itself to a list of constraints) but this is not apparent from this line. hp -- _ | Peter J. Holzer| Story must m

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

2023-03-31 Thread Peter J. Holzer
ard defines or even what C is. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature

Re: Christoph Gohlke and compiled packages

2023-04-11 Thread Peter J. Holzer
hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature -- https://m

<    2   3   4   5   6   7   8   9   10   11   >