Re: How to make a variable's late binding crosses the module boundary?

2022-08-29 Thread Peter J. Holzer
name must be hidden later. But I don't think this is the case. The module is imported but it isn't bound to any name in the current (global) namespace (obviously there must be some variable bound to it, but that's probably a local variable in the importer and it isn't called `x`). Then the object boun

Re: What can I do about this?

2022-08-28 Thread Peter J. Holzer
thing to do is to create the venv and activate it. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.as

Re: Mutating an HTML file with BeautifulSoup

2022-08-23 Thread Peter J. Holzer
On 2022-08-22 19:27:28 -, Jon Ribbens via Python-list wrote: > On 2022-08-22, Peter J. Holzer wrote: > > On 2022-08-22 00:45:56 -, Jon Ribbens via Python-list wrote: > >> With the offset though, BeautifulSoup made an arbitrary decision to > >> use ISO-8859

Re: Mutating an HTML file with BeautifulSoup

2022-08-22 Thread Peter J. Holzer
o know the the character set. (By parsing I mean only "create a syntax tree". Obviously you have to know the encoding to know whether to display «c3 bc» as «ü» or «Ã¼».) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || |

Re: Mutating an HTML file with BeautifulSoup

2022-08-22 Thread Peter J. Holzer
On 2022-08-22 00:09:01 -, Jon Ribbens via Python-list wrote: > On 2022-08-21, Peter J. Holzer wrote: > > On 2022-08-20 21:51:41 -, Jon Ribbens via Python-list wrote: > >> result = re.sub( > >> r"""(<\s*a\s+[^>]*href\s*=

Re: Mutating an HTML file with BeautifulSoup

2022-08-22 Thread Peter Otten
On 22/08/2022 05:30, Chris Angelico wrote: On Mon, 22 Aug 2022 at 10:04, Buck Evan wrote: I've had much success doing round trips through the lxml.html parser. https://lxml.de/lxmlhtml.html I ditched bs for lxml long ago and never regretted it. If you find that you have a bunch of invalid

Re: Mutating an HTML file with BeautifulSoup

2022-08-21 Thread Peter J. Holzer
en the constraints I think I would prefer that to using Beautiful Soup), but getting the regexps right is not trivial, at least in the general case. It may become a lot easier if you know that certain conventions were followed (e.g. that ">" was always

Re: Problem using cx_Freeze

2022-08-17 Thread Peter J. Holzer
convenient to extend/shorten/reorder a list. Otherwise you alway have to remember add or remove a comma in the right place. (Some people (especially SQL programmers for some reason) resorted to put the comma at the start of each line to get around this, which is really ugly.) hp --

Re: Parallel(?) programming with python

2022-08-10 Thread Peter J. Holzer
3 or 4 or maybe even 20 seconds, the producer might not even notice. (This of course depends very much on the details which we know nothing about.) hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

Re: Parallel(?) programming with python

2022-08-08 Thread Peter J. Holzer
e they are busy. hp PS: I also agree with what others have said about the perils of multi-threaded programming. -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/

Re: mailbox misbehavior with non-ASCII

2022-07-30 Thread Peter J. Holzer
On 2022-07-29 23:24:57 +, Peter Pearson wrote: > The following code produces a nonsense result with the input > described below: > > import mailbox > box = mailbox.Maildir("/home/peter/Temp/temp",create=False) > x = box.values()[0] > h = x.get(&q

mailbox misbehavior with non-ASCII

2022-07-29 Thread Peter Pearson
The following code produces a nonsense result with the input described below: import mailbox box = mailbox.Maildir("/home/peter/Temp/temp",create=False) x = box.values()[0] h = x.get("X-DSPAM-Factors") print(type(h)) # The output is the desired "str"

Re: Object in List : how?

2022-07-25 Thread Peter Otten
On 25/07/2022 02:47, Khairil Sitanggang wrote: Regarding your comment : " *However, usually object creation and initialization iscombined by allowing arguments to the initializer:*" , so which one of the two classes Node1, Node2 below is more common in practice? Option 2, I guess. Thanks, #

Re: Object in List : how?

2022-07-24 Thread Peter Otten
On 23/07/2022 06:28, Khairil Sitanggang wrote: Hello Expert: I just started using python. Below is a simple code. I was trying to check if, say, NO1 is not in the NODELIST[:].NO How can I achieve this purpose? Regards, -Irfan class Node: def __init__(self): self.NO = 0

Re: Why do I see digest replies to posts I never saw in a digest?

2022-07-23 Thread Peter J. Holzer
the start of the thread (although the one by Barry has neither an In-Reply-To nor a References header so it isn't sorted in at the correct spot). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charl

Re: list indices must be integers or slices, not str

2022-07-20 Thread Peter Otten
On 20/07/2022 11:37, Chris Angelico wrote: On Wed, 20 Jul 2022 at 18:34, Frank Millman wrote: Hi all C:\Users\E7280>python Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

Re: Creating lambdas inside generator expression

2022-06-30 Thread Peter Otten
On 29/06/2022 23:17, Chris Angelico wrote: On Thu, 30 Jun 2022 at 02:49, Johannes Bauer wrote: But now consider what happens when we create the lambdas inside a list comprehension (in my original I used a generator expresison, but the result is the same). Can you guess what happens when we

Re: Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

2022-06-27 Thread Peter J. Holzer
hedFileHandler (https://docs.python.org/3/library/logging.handlers.html#watchedfilehandler) to automatically detect when a logile has been rotated. Alternatively you can use a central logging service (like syslog) which handles all that stuff. hp -- _ | Peter J. Holzer

Re: Subtract n months from datetime

2022-06-27 Thread Peter J. Holzer
ermail/python-list/2022-April/906045.html (the latter also contains some prototype code). (I apologize for not pursuing that further at the time. I wanted to bolster that case with some real world applications, but I was a bit swamped with Real Work™ and didn't find anything suitable.) hp -

Re: Tkinter module test: widget class not inserted in application frame

2022-06-18 Thread Peter J. Holzer
n my case, as > MRAB taught me, the proper syntax is > self,'lname'... There is a comma (U+002C) here ... > self.'fname'... And a dot (U+002E) here. I don't think this is correct. I would also recommend to always add a space after a comma. hp -- _ | Peter J. Holz

Re: fill out bulletins

2022-06-14 Thread Peter Pearson
On Tue, 14 Jun 2022 00:41:07 +0200, jak wrote: [snip] > > If you are interested in seeing what I called "post office bulletin" > (English is not my language and I don't know the name, sorry), you can > find a sample pdf (fillable) but it works badly here: > >

Re: python Store text file in mangodb

2022-06-13 Thread Peter Otten
On 12/06/2022 14:40, Ayesha Tassaduq wrote: Hi i am trying to store a text file into MongoDB but i got the error . "failing because no such method exists." % self.__name.split(".")[-1] TypeError: 'Collection' object is not callable. If you meant to call the 'insert' method on a 'Collection'

Re: PYLAUNCH_DEBUG not printing info

2022-06-09 Thread Peter Otten
On 09/06/2022 00:53, Richard David wrote: Why am I not getting debug output on my windows 10 machine: C:\temp>\Windows\py.exe -0 -V:3.11 *Python 3.11 (64-bit) -V:3.10 Python 3.10 (64-bit) C:\temp>set PYLAUNCH_DEBUG=1 C:\temp>\Windows\py.exe Python 3.11.0b3 (main, Jun 1

Re: PYLAUNCH_DEBUG not printing info

2022-06-09 Thread Peter Otten
On 09/06/2022 00:53, Richard David wrote: Why am I not getting debug output on my windows 10 machine: C:\temp>\Windows\py.exe -0 -V:3.11 *Python 3.11 (64-bit) -V:3.10 Python 3.10 (64-bit) C:\temp>set PYLAUNCH_DEBUG=1 C:\temp>\Windows\py.exe Python 3.11.0b3 (main, Jun 1

Re: Filtering XArray Datasets?

2022-06-07 Thread Peter Otten
On 07/06/2022 00:28, Israel Brewster wrote: I have some large (>100GB) datasets loaded into memory in a two-dimensional (X and Y) NumPy array backed XArray dataset. At one point I want to filter the data using a boolean array created by performing a boolean operation on the dataset that is, I

Re: oop issue

2022-05-23 Thread Peter Otten
On 23/05/2022 22:54, Tola Oj wrote: i just finished learning oop as a beginner and trying to practice with it but i ran into this typeerror issue, help please. Traceback (most recent call last): File "c:\Users\ojomo\OneDrive\Desktop\myexcel\oop_learn.py\myExperiment.py\mainMain.py", line 36,

Re: Convert the decimal numbers expressed in a `numpy.ndarray` into a matrix representing elements in fractional form

2022-05-17 Thread Peter J. Holzer
when neither the search nor the replacement terms are > regular expressions) with simple string operations... > > stripped = "".join(quoted.split("'")) Whether that's easier to understand it very much in the eye of the beholder. hp -- _ | Peter

Re: EAFP

2022-05-16 Thread Peter Otten
On 13/05/2022 18:37, bryangan41 wrote: Is the following LBYL:foo = 123if foo < 200:    do()If so, how to change to EAFP?Thanks!Sent from Samsung tablet. The distinction between look-before-you-leap and easier-to-ask-forgiveness-than-permission is weaker than yo might expect. When you write

Re: Python/New/Learn

2022-05-07 Thread Peter J. Holzer
ple are probably even worse at observing the position of their various mouth parts while speaking than at listening, so without feedback from a native speaker (preferably a trained voice coach) they can't really tell whether they are doing it right. hp -- _ | Peter J

Re: Why no list as dict key?

2022-04-25 Thread Peter J. Holzer
dicts are a good fit if want to group records by subset of their attributes (think "group by" in SQL) * Objects in general are often though of as units, even if they have composite values and you might want to look up something by that value. hp -- _ | Peter J. Holzer

Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Peter J. Holzer
hat question with the information you gave us. 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 Desc

Re: tail

2022-04-23 Thread Peter J. Holzer
t going to end up iterating over it all, I would pay the > memory price. Me, too. Problem with a library function (as Marco proposes) is that you don't know how it will be used. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: Tuple unpacking inside lambda expressions

2022-04-21 Thread Peter Otten
On 20/04/2022 13:01, Sam Ezeh wrote: I went back to the code recently and I remembered what the problem was. I was using multiprocessing.Pool.pmap which takes a callable (the lambda here) so I wasn't able to use comprehensions or starmap Is there anything for situations like these? Hm, I

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-18 Thread Peter J. Holzer
thread. It doesn't test canonicalization yet (and indeed the prototype implementation is a mess in this regard) and subtracting timedeltacals from datetimes is also still missing. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | |

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-17 Thread Peter J. Holzer
On 2022-04-17 10:15:54 +0200, Peter J. Holzer wrote: > On 2022-04-17 06:08:54 +1000, Chris Angelico wrote: > > On Sun, 17 Apr 2022 at 03:37, Peter J. Holzer wrote: > > > Therefore a new class (provisionally called timedeltacal, because it is > > > calendaric, no

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-17 Thread Peter J. Holzer
On 2022-04-17 06:08:54 +1000, Chris Angelico wrote: > On Sun, 17 Apr 2022 at 03:37, Peter J. Holzer wrote: > > Datetime arithmetic in the real world is typically not done in seconds, > > but in calendaric units: Hours, days, weeks, months, years, ... > > The problem is that

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-17 Thread Peter J. Holzer
On 2022-04-16 20:35:22 -, Jon Ribbens via Python-list wrote: > On 2022-04-16, Peter J. Holzer wrote: > > On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote: > >> ... although now having looked into the new 'zoneinfo' module slightly, > >> it rea

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Peter J. Holzer
On 2022-04-17 02:46:38 +1000, Chris Angelico wrote: > On Sun, 17 Apr 2022 at 02:45, Peter J. Holzer wrote: > > For adding a datetime and timedelta I think the answer is clear. > > But subtracting two datetimes is ambiguous. > > > > But if the difference between t

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-16 Thread Peter J. Holzer
On 2022-04-16 19:35:51 +0200, Peter J. Holzer wrote: > Note that t + d - d is in general not equal to t. > > We can't cnange the semantics of datetime - datetime, so there must be a > function to compute the difference between to datetimes as a > timedeltacal. It could be a met

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Peter J. Holzer
On 2022-04-17 02:46:38 +1000, Chris Angelico wrote: > On Sun, 17 Apr 2022 at 02:45, Peter J. Holzer wrote: > > On 2022-04-17 02:14:44 +1000, Chris Angelico wrote: > > > So which one is it? Which one do you get when you add days=7 to a > > > datetime? > > > >

Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-16 Thread Peter J. Holzer
etime (maybe t.sub(u) for t-u like in Go) or a constructor which takes two datetime objects. In any case I think that u + (t - u) == t should hold. [TODO: Check that this is possible] hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | |

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Peter J. Holzer
On 2022-04-17 02:14:44 +1000, Chris Angelico wrote: > On Sun, 17 Apr 2022 at 02:03, Peter J. Holzer wrote: > > On the contrary. When a datetime is timezone aware, it must use that > > timezone's rules. Adding one day to a datetime just before a DST switch > > must add 2

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Peter J. Holzer
On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote: > On 2022-04-16, Jon Ribbens wrote: > > On 2022-04-16, Peter J. Holzer wrote: > >> Python missed the switch to DST here, the timezone is wrong. > > > > Because you didn't let it use any timezone infor

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Peter J. Holzer
On 2022-04-16 13:47:32 -, Jon Ribbens via Python-list wrote: > On 2022-04-16, Peter J. Holzer wrote: > > On 2022-04-14 15:22:29 -, Jon Ribbens via Python-list wrote: > >> On 2022-04-14, Paul Bryan wrote: > >> > I think because minutes and hours can eas

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-04-16 Thread Peter J. Holzer
here they have to be for the tools to find them (yes, this is on Ubuntu). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challen

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-16 Thread Peter J. Holzer
e: 5.542 ms hjp=> select '2022-03-26T12:00'::timestamptz + '1 day'::interval; ╔╗ ║?column?║ ╟╢ ║ 2022-03-27 12:00:00+02 ║ ╚════╝ (1 row) It correctly determines that DST is already in effect at noon of March 27th. hp

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-04-16 Thread Peter J. Holzer
On 2022-04-14 19:31:58 +0200, Marco Sulla wrote: > On Wed, 13 Apr 2022 at 20:05, Peter J. Holzer wrote: > > > > On 2022-04-12 21:03:00 +0200, Marco Sulla wrote: > > > On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote: > > > > They are are about a year

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-04-13 Thread Peter J. Holzer
On 2022-04-12 21:03:00 +0200, Marco Sulla wrote: > On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote: > > They are are about a year apart, so they will usually contain different > > versions of most packages right from the start. So the Ubuntu and Debian > > security

Re: What to do to correct the error written below:

2022-04-12 Thread Peter Pearson
On Tue, 12 Apr 2022 04:56:22 -0700 (PDT), NArshad wrote: > >>By looping over elements in "books" and incrementing counter i, >>which is used as an index both for "books" and for "students", >>you will produce an error whenever the number of books exceeds >>the number of students. Is there some

Re: What to do to correct the error written below:

2022-04-11 Thread Peter Pearson
On Mon, 11 Apr 2022 00:14:49 -0700 (PDT), NArshad wrote: [snip] > books = list(models.Book.objects.filter(isbn=i.isbn)) > students = list(models.Student.objects.filter(user=i.student_id)) > i=0 > for l in books: > >

Re: What to do to correct the error written below:

2022-04-10 Thread Peter Pearson
On Sat, 9 Apr 2022 04:59:05 -0700 (PDT), NArshad wrote: > I have accidentally deleted one account in a Django project because of > which one of the pages is no more accessible and is giving the error > written below: > > IndexError at /view_issued_book/ > list index out of range > > and the error

Re: dict.get_deep()

2022-04-08 Thread Peter J. Holzer
On 2022-04-03 23:17:04 +0200, Marco Sulla wrote: > On Sun, 3 Apr 2022 at 21:46, Peter J. Holzer wrote: > > > > data.get_deep("users", 0, "address", "street", default="second star") > > > > Yep. Did that, too. Plus pass the fin

Re: Comparing sequences with range objects

2022-04-08 Thread Peter J. Holzer
do you establish identity. The second is how do you ween out identical objects. In your first mail you only asked about the second, but that's easy. The first is really hard. Not only may information be missing, no single single piece of information is unique or immutable. Two people may have the same

[issue12445] dict view values objects are missing tp_richcmp and tp_as_number

2022-04-05 Thread Peter Lovett
Change by Peter Lovett : -- nosy: +PeterL777 ___ Python tracker <https://bugs.python.org/issue12445> ___ ___ Python-bugs-list mailing list Unsubscribe:

Re: dict.get_deep()

2022-04-03 Thread Peter J. Holzer
for i in path: try: coll = coll[i] except (KeyError, IndexError, TypeError): return default if cast: coll = cast(coll) return coll which can then be called in a single line. > Structural matching gives you warranty you proces

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-31 Thread Peter J. Holzer
On 2022-03-31 09:46:14 +0200, Cecil Westerhof via Python-list wrote: > "Peter J. Holzer" writes: > > Standard policy (there are exceptions) on most distros is to stay with > > the same version of any package for the entire lifetime. So for example, > > Ubuntu 20.04

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-30 Thread Peter J. Holzer
On 2022-03-30 08:48:36 +0200, Marco Sulla wrote: > On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote: > > They are are about a year apart, so they will usually contain different > > versions of most packages right from the start. So the Ubuntu and Debian > > security

[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett
Peter Lovett added the comment: Thanks Eric. -- ___ Python tracker <https://bugs.python.org/issue31140> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett
Peter Lovett added the comment: I'm not getting the problem on 3.9.7 on Windows. Did get it on 3.7 (3.7.11?) on a different Windows machine last week. Not getting the problem on 3.10.4 The wrong line number is a problem for IDLE's syntax highlighter, that marks the first line as a Syntax

[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett
Change by Peter Lovett : -- nosy: +PeterL777 ___ Python tracker <https://bugs.python.org/issue31140> ___ ___ Python-bugs-list mailing list Unsubscribe:

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-28 Thread Peter J. Holzer
ar. > So Ubuntu starts very close to Debian security wise, but will shift > rapidly. They are are about a year apart, so they will usually contain different versions of most packages right from the start. So the Ubuntu and Debian security teams probably can't benefit much from each other.

Re: How to detect an undefined method?

2022-03-27 Thread Peter Otten
On 27/03/2022 11:24, Manfred Lotz wrote: Let's say I have a Python app and have used an undefined method somewhere. Let us further assume I have not detected it thru my tests. Is there a way to detect it before deploying the app? pylint doesn't notice it. Minimal example: #!/usr/bin/env

Re: Behavior of the for-else construct

2022-03-09 Thread Peter J. Holzer
On 2022-03-07 06:00:57 -0800, Grant Edwards wrote: > On 2022-03-07, Peter J. Holzer wrote: > > On 2022-03-06 18:34:39 -0800, Grant Edwards wrote: > >> On 2022-03-06, Avi Gross via Python-list wrote: > >> > Python is named after a snake right? > >> &g

Re: strange problem building non-pure wheel for apple M1 arm64

2022-03-08 Thread Peter Pearson
On Mon, 7 Mar 2022 16:22:10 +, Robin Becker wrote: [snip] > > gcc -bundle -undefined dynamic_lookup -g -arch arm64 [snip] > -L/usr/local/lib > -L/usr/lib > -L/Library/Frameworks/Python.framework/Versions/3.9/lib > -lfreetype [snip] > > ld: warning: ignoring file

Re: Behavior of the for-else construct

2022-03-06 Thread Peter J. Holzer
On 2022-03-06 18:34:39 -0800, Grant Edwards wrote: > On 2022-03-06, Avi Gross via Python-list wrote: > > Python is named after a snake right? > > No. It's named after a comedy troupe. He actually wrote that two sentences later. hp -- _ | Peter J. Holzer| Story

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Peter J. Holzer
On 2022-03-06 18:28:59 +0100, Peter J. Holzer wrote: > On 2022-03-05 16:25:38 +, Barry Scott wrote: > > Using the syslog() function means that any platform/distro details are > > hidden from the user of syslog() and as is the case of macOS it > > "just works". &g

Re: Behavior of the for-else construct

2022-03-06 Thread Peter J. Holzer
> much of my grad school work in PASCAL [...] > > It's "Pascal". It's not an acronym. It's a guy's name: > > https://en.wikipedia.org/wiki/Blaise_Pascal And similarly, it's "Perl", not "PERL" (also misspelled in this thread). h

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Peter J. Holzer
On 2022-03-05 16:25:38 +, Barry Scott wrote: > On 4 Mar 2022, at 21:23, Peter J. Holzer wrote: > > If you are saying that SysLogHandler should use a system specific > > default (e.g. "/dev/log" on Linux) instead of UDP port 514 everywhere, I > > agree 99 % (the

Re: virtualenv and make DESTDIR=

2022-03-06 Thread Peter J. Holzer
t may not be true for build dependencies, though.) 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

Re: Behavior of the for-else construct

2022-03-06 Thread Peter J. Holzer
as alternative rerpresentations for characters not in the common subset of ISO-646 and EBCDIC. However, the trigraphs are extremely ugly (e.g ??< ??> instead of { }). I have seen them used (on an IBM/390 system with an EBCDIC variant without curly braces) and it's really no fun to read that.

Re: Behavior of the for-else construct

2022-03-05 Thread Peter J. Holzer
On 2022-03-05 00:25:44 +0100, Peter J. Holzer wrote: > On 2022-03-04 11:34:07 +1100, Chris Angelico wrote: > > What I'm hearing is that there are, broadly speaking, two types of > > programmers [1]: > > > > 1) Those who think about "for-else" as a search

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
On 2022-03-04 23:47:09 +, Avi Gross via Python-list wrote: > I am not sure a reply is needed, Peter, and what you say is true. But > as you point out, when using a German keyboard, I would already have > a way to enter symbols like ä, ö, ü and ß and no reason not to include > them

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
s week - but I can't find it any more which probably means that it was either in a throwaway script or I have since rewritten the code. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, &quo

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
ave to write {% if athlete_list %} {% for athlete in athlete_list %} {{ athlete.name }} {% empty %} {% else %} Sorry, no athletes in this list. {%endif %} anyway. hp -- _ | Peter J. Holzer| Sto

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
with a space (actually called "WITH SPA.TXT", because upper case only and 8+3). It was a bad idea to do this, though, because there was no way to manipulate such a file from command.com (You'd have to write another C program). hp -- _ | Peter

Re: Behavior of the for-else construct

2022-03-04 Thread Peter J. Holzer
u have to restrict yourself to a character set that most people can comfortably type on their keyboards with the key mapping provided by their OS. Which for historical reasons means US-ASCII. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) |

Re: Getting Syslog working on OSX Monterey

2022-03-04 Thread Peter J. Holzer
On 2022-02-28 22:05:05 +, Barry Scott wrote: > On 28 Feb 2022, at 21:41, Peter J. Holzer wrote: > > On 2022-02-27 22:16:54 +, Barry wrote: > >> I have always assumed that if I want a logger syslog handler that I would > >> have > >> to implement it

Re: Timezone for datetime.date objects

2022-03-02 Thread Peter J. Holzer
but without s specific context (like business days) I would agree. A day *is* a time period with a beginning and an end. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Cr

[issue44446] linecache.getline TypeError when formatting tracebacks in stacks containing an async list comprehension

2022-03-02 Thread Peter Roelants
Peter Roelants added the comment: If I understand correctly this should be fixed? In which 3.10.* version should this be fixed? The reason why I'm asking is that I ran into this issue when using Dask (2022.02.0) with multithreading on Python 3.10.2: Exception in thread Profile: Traceback

Re: All permutations from 2 lists

2022-03-02 Thread Peter Otten
On 02/03/2022 01:32, Rob Cliffe via Python-list wrote: itertools.product returns an iterator (or iterable, I'm not sure of the correct technical term). There's a simple test: iter(x) is x --> True # iterator iter(x) is x --> False # iterable So: >>> from itertools import product >>> p =

Re: Getting Syslog working on OSX Monterey

2022-02-28 Thread Peter J. Holzer
be configured to forward messages to a remote server, however). hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"

Re: One-liner to merge lists?

2022-02-27 Thread Peter Otten
On 27/02/2022 17:28, Chris Angelico wrote: On Mon, 28 Feb 2022 at 03:24, MRAB wrote: On 2022-02-27 08:51, Barry Scott wrote: On 22 Feb 2022, at 09:30, Chris Angelico wrote: On Tue, 22 Feb 2022 at 20:24, Frank Millman mailto:fr...@chagford.com>> wrote: Hi all I think this should be a

Re: PYT - The expressions described in the Python language reference yield only boolean values

2022-02-26 Thread Peter J. Holzer
| power | || primary | primary| primary| primary| atom| atom | atom | atom | literal | literal| literal| identifier | integer | integer| integer

Re: PYT - How can I subscribe to a topic in the mailing list?

2022-02-26 Thread Peter J. Holzer
of those features that seemed like a good idea to the developers but aren't really used by anyone in practice. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Cr

Re: Best way to check if there is internet?

2022-02-26 Thread Peter J. Holzer
offline mode if none (except loopback) are up. But fundamentally it's about the state of the browser ("... must return false if the user agent will not contact the network ...") not about whether your computer has "internet access" in any meaningful sense. hp --

Re: One-liner to merge lists?

2022-02-23 Thread Peter Otten
On 22/02/2022 10:44, Frank Millman wrote: On 2022-02-22 11:30 AM, Chris Angelico wrote: On Tue, 22 Feb 2022 at 20:24, Frank Millman wrote: Hi all I think this should be a simple one-liner, but I cannot figure it out. I have a dictionary with a number of keys, where each value is a single

Re: venv and executing other python programs

2022-02-15 Thread Peter J. Holzer
whether the > env-variant is good or bad. ;-) It's not that *I* use it, but > several progs in /usr/bin/. Progs in /usr/bin should IMHO never use /usr/bin/env. They should always use #!/usr/bin/python3. You might want to report that as a bug to your distribution. hp -- _ | Peter

Re: URLError:

2022-02-12 Thread Peter J. Holzer
e to an address (try «nslookup» or «host» or «dig» depending on your OS)? * Can you access the whole URL with a different tool like «wget» or «curl»? hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |

Re: PermissionError: [Errno 13] Permission denied: 'Abc.xlsx'

2022-02-12 Thread Peter J. Holzer
On 2022-02-11 18:20:19 -0500, Dennis Lee Bieber wrote: > On Fri, 11 Feb 2022 20:37:57 +0100, "Peter J. Holzer" > declaimed the following: > > >Interestingly, Excel did have the ability for multiple users editing the > >same file at some time (maybe earl

Re: PermissionError: [Errno 13] Permission denied: 'Abc.xlsx'

2022-02-11 Thread Peter J. Holzer
bility. 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 -- ht

Re: Multiple inheritance using super() in parent classes

2022-02-10 Thread Peter Otten
On 10/02/2022 09:20, Igor Basko wrote: Hi everyone, This is my first question here. Hope to get some clarification. Basically this question is about multiple inheritance and the usage of super().__init__ in parent classes. So I have two classes that inherit from the same base class. For example

Re: Logging user activity

2022-02-07 Thread Peter J. Holzer
in your app, see what data they are requesting and altering and craft appropriate log messages for each. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing

Re: Why operations between dict views return a set and not a frozenset?

2022-01-11 Thread Peter J. Holzer
et({1, 2})) with 1 0 LOAD_CONST 0 (1) 2 LOAD_CONST 1 (2) 4 BUILD_SET2 and you see the difference between using a frozenset as a constant and building a set at runtime. hp -- _ | Pet

Re: A Newspaper for Python Mailing Lists

2022-01-11 Thread Peter J. Holzer
On 2022-01-11 12:38:44 -0800, Paul Bryan wrote: > Subscribed. ️ Same. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://ww

Re: What to write or search on github to get the code for what is written below:

2022-01-09 Thread Peter J. Holzer
ted .xlsx since at least 2014 (when I started using it). For new projects I would recommend openpyxl though, which is much more feature-complete. hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |-- Charl

Re: A Newspaper for Python Mailing Lists

2022-01-08 Thread Peter J. Holzer
word-break: break-all» seems like a really weird choice for English language text. If you really want to break words across lines, use «hyphens: auto». hp -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at |

Re: Isn't TypeError built in?

2021-12-25 Thread Peter J. Holzer
above are common when the virtual environment was built with a different (older) version of the Python interpreter than the one trying to use it. Nuking and rebuilding the virtual environment is usually the quickest way to fix it. hp -- _ | Peter J. Holzer| Story must make more sense than r

[issue46153] function fails in exec when locals is given

2021-12-23 Thread Quentin Peter
Quentin Peter added the comment: Maybe a note could be added to https://docs.python.org/3/library/functions.html#exec Something along the lines of: Note: If exec gets two separate objects as `globals` and `locals`, the code will not be executed as if it were embedded in a function

[issue46153] function fails in exec when locals is given

2021-12-22 Thread Quentin Peter
Quentin Peter added the comment: Thank you for your explaination. Just to be sure, it is expected that: exec("a = 1\ndef f(): return a\nprint(f())", {}) Runs successfully but exec("a = 1\ndef f(): return a\nprint(f())&quo

[issue46153] function fails in exec when locals is given

2021-12-22 Thread Quentin Peter
Quentin Peter added the comment: The reason I am asking is that I am working on a debugger. The debugger stops on a frame which is inside a function. Let's say the locals is: locals() == {"a": 1} I now want to define a closure with exec. I might want to do something like: e

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