Re: Python Dialogs

2024-05-04 Thread Peter J. Holzer via Python-list
not being flush left? Ramism. > It is sort of contrary to what I think of as "normal" indentation. Stefan is well known for doing everything contrary to normal convention. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: xkcd.com/353 ( Flying with Python )

2024-03-31 Thread Peter J. Holzer via Python-list
s, Perl folk do use that term, specifically. I'm pretty sure he's referring to the use of @ in python to denote a decorator here. Which is a totally different thing than a Perl sigil. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: xkcd.com/353 ( Flying with Python )

2024-03-31 Thread Peter J. Holzer via Python-list
connection to the xkcd cartoon. In my opinion the connection to Perl sigils is very direct. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http:/

Re: Configuring an object via a dictionary

2024-03-17 Thread Peter J. Holzer via Python-list
On 2024-03-17 17:15:32 +1300, dn via Python-list wrote: > On 17/03/24 12:06, Peter J. Holzer via Python-list wrote: > > On 2024-03-16 08:15:19 +, Barry via Python-list wrote: > > > > On 15 Mar 2024, at 19:51, Thomas Passin via Python-list > > > > wrote: >

Re: Configuring an object via a dictionary

2024-03-16 Thread Peter J. Holzer via Python-list
letproof but I've found it very handy. 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 De

Re: A Single Instance of an Object?

2024-03-11 Thread Peter J. Holzer via Python-list
lo = lookup.get_lookup("test1") ... lo = lookup.get_lookup("test2") ... lo = lookup.get_lookup("test3") hp PS: You don't have to put that in a separate module but I think it's a lot cleaner that way. -- _ | Peter J. Holzer| Story must make mo

Re: Testing (sorry)

2024-02-20 Thread Peter J. Holzer via Python-list
ification that the mail cannot currently be delivered and that it will keep trying. Such notifications are usually sent after a much shorter period (a few hours). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

Re: Testing (sorry)

2024-02-18 Thread Peter J. Holzer via Python-list
he "nan" thread. 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 si

Re: Using my routines as functions AND methods

2024-01-06 Thread Peter J. Holzer via Python-list
pass o = Class1() f1(o, 'The plain function') works for me. > class Class2: > pass > > c1 = Class1() > c1.newfunc = f1 > c1.newfunc('f1 assigned to instance') # Works as intended Now this doesn't work any more (but the OP doesn't want that anyway, AFAICT). > Class2

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

2023-12-30 Thread Peter J. Holzer via Python-list
On 2023-12-29 09:01:24 -0800, Grant Edwards via Python-list wrote: > On 2023-12-28, Peter J. Holzer via Python-list wrote: > > On 2023-12-28 05:20:07 +, rbowman via Python-list wrote: > >> On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote: > >> > The big

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

2023-12-28 Thread Peter J. Holzer via Python-list
les from a python script (in fact I do this), but that's not what this pattern is about, AFAICS. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-23 Thread Peter J. Holzer via Python-list
t version > on the command line. In that case you might as well not have included the > shebang line at all. Right. However, that's not how scripts are usually invoked on Unix. Using /usr/bin/env in the command line is supposed to fix that but of course it assumes that your interpreter is actuall

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

2023-12-09 Thread Peter J. Holzer via Python-list
nguishes between some primitive types (string, number, boolean, null) and provides two container types (dict/object, list/array). As long as those types are sufficient, JSON includes them. If you need anything else, you're on your own. hp -- _ | Peter J. Holzer| Story must make mo

Re: Newline (NuBe Question)

2023-11-26 Thread Peter J. Holzer via Python-list
n?) context here is "if tuples are sufficient, then ..." hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"

Re: Code improvement question

2023-11-17 Thread Peter J. Holzer via Python-list
On 2023-11-17 07:48:41 -0500, Thomas Passin via Python-list wrote: > On 11/17/2023 6:17 AM, Peter J. Holzer via Python-list wrote: > > Oh, and Python (just like Perl) allows you to embed whitespace and > > comments into Regexps, which helps readability a lot if you have to > &g

Re: Code improvement question

2023-11-17 Thread Peter J. Holzer via Python-list
[0-9]{2,7} - 2 to 7 digits - - a hyphen-minus [0-9]{2} - exactly 2 digits - - a hyphen-minus [0-9]{2} - exactly 2 digits \b - a word boundary. Seems quite straightforward to me. I'll be impressed if you can write that in Python in a way which is easier to read.

Re: xor operator

2023-11-15 Thread Peter J. Holzer via Python-list
of the list. I don't know whether that's possible in your situation, because you haven't told us anything about it. All I'm suggesting is taking a step back and reconsider your choice of data structure. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: xor operator

2023-11-14 Thread Peter J. Holzer via Python-list
If you are willing to stray from the standard library, you could e.g. use pyroaring instead of sets: This is about as fast as all(test1) whether there are two bits set or a hundred. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || |

Re: Python 3.12.0 venv not working with psycopg2

2023-10-02 Thread Peter J. Holzer via Python-list
. > > https://github.com/psycopg/psycopg2/issues/1578 > https://github.com/python/cpython/issues/104830 You wil have to come up with a *minimal* test case which reproduces the problem. Expecting people to download and test your massive application is unreasonable. hp --

Re: path to python in venv

2023-09-27 Thread Peter J. Holzer via Python-list
lrwxrwxrwx 1 hjp hjp 10 Sep 28 00:45 venv/bin/python -> python3.10* lrwxrwxrwx 1 hjp hjp 10 Sep 28 00:45 venv/bin/python3 -> python3.10* lrwxrwxrwx 1 hjp hjp 15 Sep 28 00:45 venv/bin/python3.10 -> /bin/python3.10* hp -- _ | Peter J. Holzer| Story must make more

Re: The GIL and PyEval_RestoreThread

2023-09-27 Thread Peter Ebden via Python-list
it should try to acquire the GIL again and wait until it can (although possibly also that it's not an expected use and Python thread states are expected to be more 1:1 with C threads). On Wed, Sep 27, 2023 at 3:53 AM MRAB via Python-list wrote: > On 2023-09-26 14:20, Peter Ebden via Python-list w

The GIL and PyEval_RestoreThread

2023-09-26 Thread Peter Ebden via Python-list
occasionally switches threads, which I guess might well happen with that time.sleep() call, but I wasn't expecting the same thread to become usable somewhere else. Maybe I am just confusing things by approaching the same Python thread from multiple OS threads concurrently and should be managing my o

dateutil on PyPI (was: PEP668 / pipx and "--editable" installs)

2023-09-20 Thread Peter J. Holzer via Python-list
On 2023-09-20 13:31:14 +, c.buhtz--- via Python-list wrote: > Dear Peter, > > maybe we have a missunderstanding. > > Am 20.09.2023 14:43 schrieb Peter J. Holzer via Python-list: > > > > > "dateutil" is not available from PyPi for Python 3.11 > &

Re: PEP668 / pipx and "--editable" installs

2023-09-20 Thread Peter J. Holzer via Python-list
On 2023-09-18 18:56:35 +, c.buhtz--- via Python-list wrote: > On 2023-09-18 10:16 "Peter J. Holzer via Python-list" > wrote: > > On 2023-09-15 14:15:23 +, c.buhtz--- via Python-list wrote: > > > I tried to install it via "pipx install -e .[develop]&q

Re: PEP668 / pipx and "--editable" installs

2023-09-18 Thread Peter J. Holzer via Python-list
ateutil Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) 247.7/247.7 kB 3.1 MB/s eta 0:00:00 Collecting six>=1.5 Downloading six-1.16.0-py2.py3-none-any.whl (11 kB) Installing collected packages: six, python-dateutil Successfully installed python-dateutil-2.8.2 six-1.16

Re: Postgresql equivalent of Python's timeit?

2023-09-17 Thread Peter J. Holzer via Python-list
On 2023-09-17 11:01:43 +0200, Albert-Jan Roskam via Python-list wrote: >On Sep 15, 2023 19:45, "Peter J. Holzer via Python-list" > wrote: > > On 2023-09-15 17:42:06 +0200, Albert-Jan Roskam via Python-list wrote: > >    This is more related to Postg

Re: `time.perf_counter_ns` always a 64-bit int?

2023-09-16 Thread Peter J. Holzer via Python-list
ou expect your system to have an uptime in excess of 292 years, don't worry. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www

Re: Postgresql equivalent of Python's timeit?

2023-09-15 Thread Peter J. Holzer via Python-list
ost of the data will already be in memory.) 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 D

Re: Passing info to function used in re.sub

2023-09-04 Thread Peter J. Holzer via Python-list
gs that involves for info # that what's available in m replacement_text = m.group(1) + local_var1 + local_var2 return replacement_text for md_text in ( "aardvark", "barbapapa", "ba ba ba ba barbara ann"): new_text = re.sub(r"(a+)

Re: What sort of exception when a class can't find something?

2023-08-31 Thread Peter J. Holzer via Python-list
re be? Is it maybe a ValueError? It you are going for a builtin exception, I think KeyError is the most appropriate: It should be a LookupError, since the lookup failed and a database is more like a mapping than a sequence. But it would probably be best to define your own exception for that. hp --

Re: Using "textwrap" package for unwrappable languages (Japanese)

2023-08-30 Thread Peter J. Holzer via Python-list
On 2023-08-30 13:18:25 +, c.buhtz--- via Python-list wrote: > Am 30.08.2023 14:07 schrieb Peter J. Holzer via Python-list: > > another caveat: Japanese characters are usually double-width. So > > (unless your line length is 130 characters for English) you would > > want t

Re: Using "textwrap" package for unwrappable languages (Japanese)

2023-08-30 Thread Peter J. Holzer via Python-list
n_width() seems to be the canonical name to find the width of a character, but it returns a code (like 'W' or 'Na') not a number.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "C

Where is the error?

2023-08-06 Thread Peter J. Holzer via Python-list
as a bit longer of course, so I checked the lines before that to see if I forgot to close any parentheses. Took me some time to notice the missing comma *after* the underlined expression. Is this "clairvoyant" behaviour a side-effect of the new parser or was that a deliberate decis

Working with paths

2023-07-16 Thread Peter Slížik via Python-list
str() as path: print("string") case bytes() as path: print("bytes") case os.PathLike() as path: print("os.PathLike") Should I branch on the individual types or is there a more elegant way? Peter -- https://mail.python.org/mailman/listinfo/python-list

Best practices for using super()

2023-07-04 Thread Peter Slížik via Python-list
all works, but are there situations in which calling them explicitly using a parent class name is preferred? Best regards, Peter -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiple inheritance and a broken super() chain

2023-07-04 Thread Peter Slížik via Python-list
e formatting of my code examples was completely removed; sorry for that. Best regards, Peter -- https://mail.python.org/mailman/listinfo/python-list

Multiple inheritance and a broken super() chain

2023-07-03 Thread Peter Slížik via Python-list
e: Top.__init__() Right.__init__() Left.__init__() Top.__init__() Right.__init__() Bottom.__init__() Now, as I see it, from the super()'s point of view, there are two inheritance chains, one starting at Left and the other at Right. But *Right.__init__()* is called twice. What's going on here? Thanks, P

Re: Bug in io.TextIOWrapper?

2023-06-19 Thread Peter J. Holzer via Python-list
) Traceback (most recent call last): File "", line 1, in ValueError: I/O operation on closed file. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __

Should NoneType be iterable?

2023-06-19 Thread Peter Bona via Python-list
r x in mylist: print(x) I think Python should handle this case gracefully: if a code would iterate over None: it should not run any step. but proceed the next statement. Has this been discussed or proposed? Thanks Peter -- https://mail.python.org/mailman/listinfo/python-list

Re: File system path annotations

2023-06-19 Thread Peter Slížik via Python-list
People on the Internet keep using *str* as their path representation choice. Presumably, programmers don't feel the need to bother with a complex solution if the simplest option works just fine. Peter -- https://mail.python.org/mailman/listinfo/python-list

File system path annotations

2023-06-19 Thread Peter Slížik via Python-list
asking the obvious, but after some googling I came to the conclusion that information on this topic is surprisingly limited to a few StackOverflow questions. Best regards, Peter -- https://mail.python.org/mailman/listinfo/python-list

Re: Log File

2023-05-31 Thread Peter J. Holzer
y once in a while (e.g. every 100 MB or every 10 lines). That will give you reassurance that the program is working and a rough estimate when it will be finished. Or you can log any other information you think might be useful. hp -- _ | Peter J. Holzer| Story must make more

Re: getting rid of the recursion in __getattribute__

2023-05-25 Thread Peter Otten
On 24/05/2023 15:37, A KR wrote: It is perfectly explained in the standards here [1] saying that: In order to avoid infinite recursion in this method, its implementation should always call the base class method with the same name to access any attributes it needs, for example,

Re: OT: Addition of a .= operator

2023-05-24 Thread Peter J. Holzer
ead that code. hp [1] Which is often yourself, a few months older. Or it could be an experienced colleague who's very familiar with the codebase. Or a new colleague trying to understand what this is all about (possibly while learning Python). -- _ | Peter J. Holzer| Story must make m

Re: Addition of a .= operator

2023-05-24 Thread Peter J. Holzer
On 2023-05-24 08:51:19 +1000, Chris Angelico wrote: > On Wed, 24 May 2023 at 08:48, Peter J. Holzer wrote: > > Yes, that probably wasn't the best example. I sort of deliberately > > avoided method chaining here to make my point that you don't have to > > invent a new va

Re: Addition of a .= operator

2023-05-23 Thread Peter J. Holzer
On 2023-05-24 07:12:32 +1000, Chris Angelico wrote: > On Wed, 24 May 2023 at 07:04, Peter J. Holzer wrote: > > But I find it easier to read if I just reuse the same variable name: > > > > user = request.GET["user"] > > user = str(user, encodi

Re: Addition of a .= operator

2023-05-23 Thread Peter J. Holzer
= user.strip() user = user.lower() user = orm.user.get(name=user) Each instance only has a livetime of a single line (or maybe two or three lines if I have to combine variables), so there's little risk of confusion, and reusing the variable name makes it very clear that all those intermediate

Re: Addition of a .= operator

2023-05-20 Thread Peter J. Holzer
.data[line+len(chars)-1] + self.data[line+len(chars)-1] + after hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | chall

Re: Problem with accented characters in mailbox.Maildir()

2023-05-09 Thread Peter J. Holzer
On 2023-05-08 23:02:18 +0200, jak wrote: > Peter J. Holzer ha scritto: > > On 2023-05-06 16:27:04 +0200, jak wrote: > > > Chris Green ha scritto: > > > > Chris Green wrote: > > > > > A bit more information, msg.get("subject"

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Peter J. Holzer
) elif type(chunk[0]) == bytes: r += chunk[0].decode('us-ascii') else: r += chunk[0] return r (this is maybe a bit more forgiving than the OP needs, but I had to deal with malformed mails) I do have to say that Python is extraordinarily clumsy in

Re: What do these '=?utf-8?' sequences mean in python?

2023-05-08 Thread Peter Pearson
On Sat, 6 May 2023 14:50:40 +0100, Chris Green wrote: [snip] > So, what do those =?utf-8? and ?= sequences mean? Are they part of > the string or are they wrapped around the string on output as a way to > show that it's utf-8 encoded? Yes, "=?utf-8?" signals "MIME header encoding". I've only

Re: Question regarding unexpected behavior in using __enter__ method

2023-04-21 Thread Peter Otten
On 21/04/2023 00:44, Lorenzo Catoni wrote: Dear Python Mailing List members, I am writing to seek your assistance in understanding an unexpected behavior that I encountered while using the __enter__ method. I have provided a code snippet below to illustrate the problem: ``` class X: ...

Re: Cannot install pkg_resources using pip

2023-04-17 Thread Peter J. Holzer
e that he's been comfortably using Slackware for 20 years, I'll trust that he knows how to do that and just needed a little nudge into the right direction. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

Re: Weak Type Ability for Python

2023-04-15 Thread Peter J. Holzer
e are distinct operators for addition and string > concatenation, with automatic type conversion (non-numeric strings have a > numeric value of 0, which can hide bugs). You get a warning for that, though. hp -- _ | Peter J. Holzer| Story mus

Re: Weak Type Ability for Python

2023-04-15 Thread Peter J. Holzer
ate an int, create an EnhancedInt instead". A bit tricky to > implement. Or alternatively you might be able to add or replace methods on the existing int class. So 5 is still just an int, but now (5 + "x") calls the modified __add__ method which knows how add a string to an int. Mig

Re: Weak Type Ability for Python

2023-04-13 Thread Peter J. Holzer
strings. For arrays its a (somewhat bizarre) union. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signatu

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

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

2023-03-31 Thread Peter J. Holzer
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 -- https://ma

Re: When is logging.getLogger(__name__) needed?

2023-03-31 Thread Peter Otten
() File "", line 2, in use_name print(name) NameError: name 'name' is not defined Binding (=assigning to) a name inside a function makes it local to that function. If you want a global (module-level) name you have to say so: >>> def define_name(): global name

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

2023-03-27 Thread Peter J. Holzer
the whole 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: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Peter J. Holzer
lf.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. -- _ | Peter J. Hol

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 IDE. It was

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

2023-03-18 Thread Peter J. Holzer
: > 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 |-- Charle

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

2023-03-18 Thread Peter J. Holzer
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. |_|_) || | | | h...@hjp.at |-- Charl

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

2023-03-14 Thread Peter J. Holzer
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: Fast full-text searching in Python (job for Whoosh?)

2023-03-08 Thread Peter J. Holzer
at 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. Holzer| Story mu

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

2023-03-07 Thread Peter J. Holzer
e 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: Which more Pythonic - self.__class__ or type(self)?

2023-03-04 Thread Peter J. Holzer
;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 Stross

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

2023-03-03 Thread Peter J. Holzer
uage 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. hp

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

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

Cryptic software announcements (was: ANN: DIPY 1.6.0)

2023-02-28 Thread Peter J. Holzer
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 |-- Charles Stross, "

Re: How to escape strings for re.finditer?

2023-02-28 Thread Peter J. Holzer
e 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 __/ | http://www.hj

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

2023-02-25 Thread Peter J. Holzer
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, "Creati

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: Is there a more efficient threading lock?

2023-02-25 Thread Peter J. Holzer
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...@hjp.at

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: 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-24 Thread Peter J. Holzer
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 be reached)).

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

2023-02-24 Thread Peter J. Holzer
= 1 failed in 0.09s = hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | ht

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

2023-02-24 Thread Peter J. Holzer
ible 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 Stross, "Creative

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

2023-02-24 Thread Peter J. Holzer
^ | 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| Story must make more sense than reality. |_|_) |

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

Re: File write, weird behaviour

2023-02-19 Thread Peter J. Holzer
esult 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 make more sense tha

Re: File write, weird behaviour

2023-02-19 Thread Peter J. Holzer
. 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 would generally use some k

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: Precision Tail-off?

2023-02-18 Thread Peter J. Holzer
n'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
ng 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 solved for decades and is absolutely incidental to roaring bitmaps and completel

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: Precision Tail-off?

2023-02-17 Thread Peter J. Holzer
;. 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 J. Holzer| Story

Re: Precision Tail-off?

2023-02-17 Thread Peter J. Holzer
tional" 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 |-- Charles Stross, "Creative writing __/

Re: Comparing caching strategies

2023-02-17 Thread Peter J. Holzer
ell 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 padding. Again: What would b

Re: Precision Tail-off?

2023-02-17 Thread Peter Pearson
On Fri, 17 Feb 2023 10:27:08, Stephen Tucker wrote:[Head-posting undone.] > On Thu, Feb 16, 2023 at 6:49 PM Peter Pearson > wrote: >> On Tue, 14 Feb 2023 11:17:20 +, Oscar Benjamin wrote: >> > On Tue, 14 Feb 2023 at 07:12, Stephen Tucker >> wrote: >>

Re: Precision Tail-off?

2023-02-16 Thread Peter Pearson
On Tue, 14 Feb 2023 11:17:20 +, Oscar Benjamin wrote: > On Tue, 14 Feb 2023 at 07:12, Stephen Tucker wrote: [snip] >> I have just produced the following log in IDLE (admittedly, in Python >> 2.7.10 and, yes I know that it has been superseded). >> >> It appears to show a precision tail-off as

Re: Python: How to use the 'trace' module programmatically?

2023-02-16 Thread Peter Slížik
Gerard - I did not use the filtering options. Thank you for bringing them to my attention. Barry - thank you for the insight. Now the tracing works as expected. I'm not sure why it didn't work before... Maybe the program redirected stdout? Thank you guys, Peter On Thu, Feb 16, 2023 at 9:56 AM

Python: How to use the 'trace' module programmatically?

2023-02-15 Thread Peter Slížik
when I set count=1, I was able to catch the coverage data with tracer.results() and write them to a file. But the tracing information was not generated even in this case. Am I doing anything wrong? Peter -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about logging.config.dictConfig

2023-02-07 Thread Peter J. Holzer
e)s %(funcName)s > %(message)s' 'format' > } > }, [...] > } > logging.config.dictConfig(config) > > When I run uselog.py it prints nothing. I am wondering what is wrong > with the second configuration. See above.

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

2023-02-05 Thread Peter J. Holzer
e 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. hp -- _ | Peter J. Holzer| S

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: Custom help format for a choice argparse argument

2023-01-30 Thread Peter Otten
On 27/01/2023 21:31, Ivan "Rambius" Ivanov wrote: Hello, I am developing a script that accepts a time zone as an option. The time zone can be any from pytz.all_timezones. I have def main(): parser = argparse.ArgumentParser() parser.add_argument("-z", "--zone",

  1   2   3   4   5   6   7   8   9   10   >