Re: Polymorphic imports

2021-09-21 Thread Chris Angelico
On Wed, Sep 22, 2021 at 4:59 AM Travis Griggs wrote: > > I guess this is kind of like mocking for testing. I have a simple module > that's imported in a number of other spots in my program. There's a condition > in the OS/filesystem where I'd like to import a polymorphically compatible >

Re: issue for setup pandas

2021-09-21 Thread Chris Angelico
On Tue, Sep 21, 2021 at 11:53 PM Fady Victor Mikhael Abdelmalk wrote: > > > Dear Python Team, > > I got the below issue when trying to install python on my user. Kindly assist > to know how can I solved. > > > WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Chris Angelico
On Tue, Sep 21, 2021 at 3:58 AM Mostowski Collapse wrote: > > I read the following, and you should also know: > > > Python's [] is implemented as an array, not a linked list. > > Although resizing is O(n), appending to it is amortized O(1), > > because resizes happen very rarely. >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Chris Angelico
On Tue, Sep 21, 2021 at 3:51 AM Mostowski Collapse wrote: > > sympy also builds a language on top of Python. > pandas also builds a language on top of Python. > > Is there some pope that says this wouldn't be > allowed, I dont think so, otherwise sympy, pandas, etc.. > > wouldn't exist. I dont

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-20 Thread Chris Angelico
On Mon, Sep 20, 2021 at 9:50 PM Peter J. Holzer wrote: > > Let Python be Python, don't try to build your own language on top of > > it. > > Well, he's writing a Prolog interpreter, so building his own language on > top of Python is sort of the point. I think a better way to put it is > "Don't try

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-19 Thread Chris Angelico
ponding [*] node from the list. > > > > You can also attach callbacks to weakref objects that are triggered > > when the referenced object dies. You might be able to make use of > > that to remove items from the trail instead of the periodic scanning. > > Question

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-18 Thread Chris Angelico
On Sun, Sep 19, 2021 at 11:46 AM Mostowski Collapse wrote: > > Yeah, it seems weak references could indeed spare > me mark_term(). But then I am stil left with sweep_trail(). > I did not yet measure what takes more time mark_term() > or sweep_trail(). The displayed "gc" is the sum of both. > >

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-16 Thread Chris Angelico
On Fri, Sep 17, 2021 at 7:17 AM Mostowski Collapse wrote: > > About Exceptions: Thats just building ISO core > standard Prolog error terms. > > About Garbage Collection: Thats just Prolog > garbage collection, which does shrink some > single linked lists, which ordinary > programmig language GC

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-16 Thread Chris Angelico
On Fri, Sep 17, 2021 at 3:20 AM Mostowski Collapse wrote: > > Compound is not used for boxing. Integers and floats > are represented directly. Also integers are not mapped to > floats. But maybe compound could be a little flattened, > "Boxing" in this case isn't about ints and floats, since

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-15 Thread Chris Angelico
On Thu, Sep 16, 2021 at 7:59 AM Mostowski Collapse wrote: > > BTW: I could already make it faster, by not repeatedly > accessing .arg anymore. It went down from ca.: > > 171'000 ms > > To this here: > > 140'000 ms > > But only in the cold run. In the warm run it went back > to 171'000 ms.

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-15 Thread Chris Angelico
On Thu, Sep 16, 2021 at 5:15 AM Mostowski Collapse wrote: > > If you find a "wonky" spot, I can replace it by "non-wonky" > code. I noticed some differences between Python Dicts > and JavaScript objects. Python tends to throw more exceptions. > > So in Python I now do the following: > >peek =

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-15 Thread Chris Angelico
On Thu, Sep 16, 2021 at 3:17 AM Mostowski Collapse wrote: > > I really wonder why my Python implementation > is a factor 40 slower than my JavaScript implementation. > Structurally its the same code. > Very hard to know. Your code is detailed and complicated. Do they produce identical results?

Re: on floating-point numbers

2021-09-11 Thread Chris Angelico
On Sun, Sep 12, 2021 at 1:07 AM Peter J. Holzer wrote: > If you have any "decimals" (i.e decimal digits to the right of your > decimal point) then the input values won't be exactly representable and > the nearest representation will use all available bits, thus losing some > precision with most

Re: on writing a while loop for rolling two dice

2021-09-11 Thread Chris Angelico
On Sat, Sep 11, 2021 at 3:26 PM dn via Python-list wrote: > > On 31/08/2021 01.50, Chris Angelico wrote: > > On Mon, Aug 30, 2021 at 11:13 PM David Raymond > > wrote: > >> > >>> def how_many_times(): > >>> x, y = 0, 1 > >>>

Re: Connecting python to DB2 database

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 1:26 PM DFS wrote: > > On 9/3/2021 9:50 AM, Chris Angelico wrote: > > On Fri, Sep 3, 2021 at 11:37 PM DFS wrote: > >> > >> On 9/3/2021 1:47 AM, Chris Angelico wrote: > >>> On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: > >&g

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:58 PM Greg Ewing wrote: > > On 5/09/21 2:42 am, Hope Rouselle wrote: > > Here's what I did on this case. The REPL is telling me that > > > >7.23 = 2035064081618043/281474976710656 > > If 7.23 were exactly representable, you would have got > 723/1000. > > Contrast

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:55 PM Hope Rouselle wrote: > > Julio Di Egidio writes: > > > On Thursday, 2 September 2021 at 16:51:24 UTC+2, Christian Gollwitzer wrote: > >> Am 02.09.21 um 16:49 schrieb Julio Di Egidio: > >> > On Thursday, 2 September 2021 at 16:41:38 UTC+2, Peter Pearson wrote: > >>

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:44 PM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Fri, Sep 3, 2021 at 4:29 AM Hope Rouselle wrote: > >> > >> Just sharing a case of floating-point numbers. Nothing needed to be > >> solved or to be f

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:39 PM Alan Gauld via Python-list wrote: > > On 03/09/2021 18:37, Chris Angelico wrote: > > >>>> Without DST the schools opened in the dark so all the kids > >>>> had to travel to school in the dark and the number of > >>

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 1:04 PM Hope Rouselle wrote: > The same question in other words --- what's a trivial way for the REPL > to show me such cycles occur? > > >> 7.23.as_integer_ratio() > >>> (2035064081618043, 281474976710656) > > Here's what I did on this case. The REPL is telling me

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:50 PM Hope Rouselle wrote: > > Christian Gollwitzer writes: > > > Am 02.09.21 um 15:51 schrieb Hope Rouselle: > >> Just sharing a case of floating-point numbers. Nothing needed to be > >> solved or to be figured out. Just bringing up conversation. > >> (*) An

Re: on floating-point numbers

2021-09-04 Thread Chris Angelico
On Sun, Sep 5, 2021 at 12:48 PM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Fri, Sep 3, 2021 at 4:58 AM Hope Rouselle wrote: > >> > >> Hope Rouselle writes: > >> > >> > Just sharing a case of floating-point numbers. Nothing

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-03 Thread Chris Angelico
On Sat, Sep 4, 2021 at 3:33 AM Alan Gauld via Python-list wrote: > > On 02/09/2021 19:30, Chris Angelico wrote: > > >> Without DST the schools opened in the dark so all the kids > >> had to travel to school in the dark and the number of > >> traffic a

Re: on floating-point numbers

2021-09-03 Thread Chris Angelico
On Sat, Sep 4, 2021 at 12:08 AM o1bigtenor wrote: > Hmmm - - - ZI would suggest that you haven't looked into > taxation yet! > In taxation you get a rational number that MUST be multiplied by > the amount in currency. (You can, of course, multiply a currency amount by any scalar. Just not by

Re: Connecting python to DB2 database

2021-09-03 Thread Chris Angelico
On Fri, Sep 3, 2021 at 11:37 PM DFS wrote: > > On 9/3/2021 1:47 AM, Chris Angelico wrote: > > On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: > >> > >> Having a problem with the DB2 connector > >> > >> test.py > >> --

Re: on floating-point numbers

2021-09-03 Thread Chris Angelico
On Fri, Sep 3, 2021 at 10:42 PM jak wrote: > > Il 03/09/2021 09:07, Julio Di Egidio ha scritto: > > On Friday, 3 September 2021 at 01:22:28 UTC+2, Chris Angelico wrote: > >> On Fri, Sep 3, 2021 at 8:15 AM Dennis Lee Bieber > >> wrote: > >>> On Fri,

Re: Connecting python to DB2 database

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: > > Having a problem with the DB2 connector > > test.py > > import ibm_db_dbi > connectstring = > 'DATABASE=xxx;HOSTNAME=localhost;PORT=5;PROTOCOL=TCPIP;UID=xxx;PWD=xxx;' > conn =

Re: on floating-point numbers

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 8:15 AM Dennis Lee Bieber wrote: > > On Fri, 3 Sep 2021 04:43:02 +1000, Chris Angelico > declaimed the following: > > > > >The naive summation algorithm used by sum() is compatible with a > >variety of different data types - even lists, althou

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 8:01 AM Alan Gauld via Python-list wrote: > > On 02/09/2021 19:28, Chris Angelico wrote: > > >> Except for the places that don't follow the IANA scheme and/or > >> dynamically change their time settings on a whim. To be complete > >&

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:40 AM Alan Gauld via Python-list wrote: > > On 31/08/2021 23:31, Chris Angelico wrote: > > > Ah, good to know. I think that actually makes a lot of sense; in the > > US, they try to let everyone pretend that the rest of the world > > doesn

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:26 AM Alan Gauld via Python-list wrote: > > On 31/08/2021 22:32, Chris Angelico wrote: > > > If we could abolish DST world-wide, life would be far easier. All the > > rest of it would be easy enough to handle. > We tried that in the UK for

Re: on floating-point numbers

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:58 AM Hope Rouselle wrote: > > Hope Rouselle writes: > > > Just sharing a case of floating-point numbers. Nothing needed to be > > solved or to be figured out. Just bringing up conversation. > > > > (*) An introduction to me > > > > I don't understand floating-point

Re: on writing a while loop for rolling two dice

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:51 AM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Mon, Aug 30, 2021 at 11:13 PM David Raymond > > wrote: > >> > >> > def how_many_times(): > >> > x, y = 0, 1 > >> > c = 0

Re: on floating-point numbers

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:29 AM Hope Rouselle wrote: > > Just sharing a case of floating-point numbers. Nothing needed to be > solved or to be figured out. Just bringing up conversation. > > (*) An introduction to me > > I don't understand floating-point numbers from the inside out, but I do >

Re: on writing a while loop for rolling two dice

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:33 AM Hope Rouselle wrote: > Yeah. Here's a little context. I came across this by processing a list > of exercises. (I'm teaching a course --- you know that by now, I > guess.) So the first thing I observed was the equal volume of work > dedicated to while loops and

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:22 AM Alan Gauld via Python-list wrote: > > On 31/08/2021 22:13, Chris Angelico wrote: > > > But ultimately, it all just means that timezones are too hard for > > humans to handle, and we MUST handle them using IANA's database. It is > &g

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:18 AM Dennis Lee Bieber wrote: > > On Tue, 31 Aug 2021 16:53:14 -0500, 2qdxy4rzwzuui...@potatochowder.com > declaimed the following: > > >On 2021-09-01 at 07:32:43 +1000, > >Chris Angelico wrote: > >> If we could abolish DST world-wi

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 9:20 AM dn via Python-list wrote: > > On 01/09/2021 09.13, Chris Angelico wrote: > > On Wed, Sep 1, 2021 at 6:38 AM dn via Python-list > > wrote: > >>> Yeah. I do recommend making good use of the IANA tzinfo database > >>>

Re: urgent

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 9:03 AM Barry wrote: > > > > > On 31 Aug 2021, at 16:53, jak wrote: > > > > Il 31/08/2021 03:05, Python ha scritto: > >> Hari wrote: > >>> i was download ur python software but it is like boring user interface for > >>> me like young student to learn ,can u have any

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 8:22 AM MRAB wrote: > > [snip] > In the EU, DST in the member states changes at the same time. It's not > like the US where it ripples across the timezones, so the differences > vary during the change. It all happens in one go. > Ah, good to know. I think that actually

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 7:54 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-09-01 at 07:32:43 +1000, > Chris Angelico wrote: > > > On Wed, Sep 1, 2021 at 7:17 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > What about P

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 7:17 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-09-01 at 08:36:55 +1200, > dn via Python-list wrote: > > > ... there is less consideration about working-out what time it is in > > Pune cf Kolkata, than between (say) San Francisco and Denver - > > although

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 6:38 AM dn via Python-list wrote: > > Yeah. I do recommend making good use of the IANA tzinfo database > > though (especially since Python 3.9 made that a bit easier to access), > > as it's usually easier to get people to tell you what city/state > > they're in, rather than

Re: Struggling to understand timedelta rpesentation when applying an offset for an hour earlier - why is days = -1?

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 1:55 AM dcs3spp via Python-list wrote: > > Hi, > > I wonder if anyone can help > > I am struggling to understand the representation of timedelta when used in > conjunction with astimezone. > > Given the code below, in a python interactive interpreter, I am trying to >

Re: Create a real-time interactive TUI using Python.

2021-08-31 Thread Chris Angelico
On Wed, Sep 1, 2021 at 1:59 AM hongy...@gmail.com wrote: > > I want to know whether python can be used to create real-time interactive > TUI, as hstr [1] does. > > [1] https://github.com/dvorka/hstr > Yes. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Chris Angelico
On Tue, Aug 31, 2021 at 8:55 PM MRAB wrote: > > On 2021-08-31 02:16, dn via Python-list wrote: > > On 31/08/2021 11.07, Dennis Lee Bieber wrote: > >> On Sun, 29 Aug 2021 19:49:19 -0700 (PDT), "hongy...@gmail.com" > >> declaimed the following: > > ... > > > >> Might have helped to mention

Re: on writing a while loop for rolling two dice

2021-08-30 Thread Chris Angelico
On Tue, Aug 31, 2021 at 12:28 AM Peter Otten <__pete...@web.de> wrote: > > On 30/08/2021 15:50, Chris Angelico wrote: > > > def how_many_times(): > > return next((count, rolls) for count, rolls in > > enumerate(iter(roll, None)) if len(Counter(rolls)) == 1

Re: on writing a while loop for rolling two dice

2021-08-30 Thread Chris Angelico
On Mon, Aug 30, 2021 at 11:13 PM David Raymond wrote: > > > def how_many_times(): > > x, y = 0, 1 > > c = 0 > > while x != y: > > c = c + 1 > > x, y = roll() > > return c, (x, y) > > Since I haven't seen it used in answers yet, here's another option using our > new walrus

Re: on writing a while loop for rolling two dice

2021-08-29 Thread Chris Angelico
On Mon, Aug 30, 2021 at 9:53 AM dn via Python-list wrote: > > On 29/08/2021 22.24, Chris Angelico wrote: > > On Sun, Aug 29, 2021 at 8:14 PM dn via Python-list > > wrote: > >> Efficiency: > >> - wonder how max( d ) == min( d ) compares for speed

Re: PEP Idea: Real private attribute

2021-08-29 Thread Chris Angelico
On Mon, Aug 30, 2021 at 5:49 AM Mehrzad Saremi wrote: > > No, a class ("the class that I'm lexically inside") cannot be accessed from > outside of the class. This is why I'm planning to offer it as a core > feature because only the parser would know. There's apparently no elegant > solution if

Re: on writing a while loop for rolling two dice

2021-08-29 Thread Chris Angelico
On Sun, Aug 29, 2021 at 8:14 PM dn via Python-list wrote: > Efficiency: > - wonder how max( d ) == min( d ) compares for speed with the set() type > constructor? That may or may not be an improvement. > - alternately len( d ) < 2? > - or len( d ) - 1 coerced to a boolean by the if? Neither of

Re: PEP Idea: Real private attribute

2021-08-28 Thread Chris Angelico
On Sun, Aug 29, 2021 at 7:40 AM Mehrzad Saremi wrote: > > Python currently uses name mangling for double-underscore attributes. Name > mangling is not an ideal method to avoid name conflicting. There are > various normal programming patterns that can simply cause name conflicting > in

Re: on the popularity of loops while and for

2021-08-28 Thread Chris Angelico
On Sun, Aug 29, 2021 at 7:40 AM Hope Rouselle wrote: > > I'd like get a statistic of how often each loop is used in practice. > > I was trying to take a look at the Python's standard libraries --- those > included in a standard installation of Python 3.9.6, say --- to see > which loops are more

Re: on writing a while loop for rolling two dice

2021-08-28 Thread Chris Angelico
On Sun, Aug 29, 2021 at 7:37 AM Hope Rouselle wrote: > > How should I write this? I'd like to roll two six-sided dice until I > get the same number on both. I'd like to get the number of times I > tried. Here's a primitive I'm using: > > --8<---cut

Re: basic auth request

2021-08-25 Thread Chris Angelico
On Thu, Aug 26, 2021 at 12:48 AM Jon Ribbens via Python-list wrote: > > On 2021-08-25, Chris Angelico wrote: > > On Thu, Aug 26, 2021 at 12:16 AM Jon Ribbens via Python-list > > wrote: > >> There are so many trusted CAs these days that the chances of them all > &

Re: basic auth request

2021-08-25 Thread Chris Angelico
On Thu, Aug 26, 2021 at 12:16 AM Jon Ribbens via Python-list wrote: > > On 2021-08-25, Chris Angelico wrote: > > On Wed, Aug 25, 2021 at 5:20 PM Barry Scott wrote: > >> Only if this threat model matters to you or your organisation. > >> Personal its low d

Re: basic auth request

2021-08-25 Thread Chris Angelico
On Wed, Aug 25, 2021 at 5:20 PM Barry Scott wrote: > > Only if this threat model matters to you or your organisation. > Personal its low down of the threats I watch out for. > > The on-line world and the real-world are the same here. > > If a business changes hands then do you trust the new

Re: PyQt5 is not recognized from python 3.8 installation in python 3.10

2021-08-22 Thread Chris Angelico
On Mon, Aug 23, 2021 at 4:31 AM Mohsen Owzar wrote: > How can I get all the packages available in 3.8 version also available for > 3.10 version without any new installation in 3.10 for each all already > existing packages? > You can't. With compiled binaries, especially, it's important to

Re: basic auth request

2021-08-22 Thread Chris Angelico
On Sun, Aug 22, 2021 at 8:30 PM Barry Scott wrote: > > > > On 22 Aug 2021, at 10:37, Chris Angelico wrote: > > When it comes to security, one thing I'm very curious about is why we > don't have any sort of certificate renewal verification. My browser > could retain the

Re: from foo import bar and the ast module

2021-08-22 Thread Chris Angelico
On Mon, Aug 23, 2021 at 12:26 AM Dan Stromberg wrote: > > > On Sun, Aug 22, 2021 at 7:14 AM Chris Angelico wrote: >> >> On Mon, Aug 23, 2021 at 12:08 AM Dan Stromberg wrote: >> > >> > In 'from foo import bar': >> > >> > With the ast modu

Re: from foo import bar and the ast module

2021-08-22 Thread Chris Angelico
On Mon, Aug 23, 2021 at 12:08 AM Dan Stromberg wrote: > > In 'from foo import bar': > > With the ast module, I see how to get bar, but I do not yet see how to get > the foo. > > There are clearly ast.Import and ast.ImportFrom, but I do not see the foo > part in ast.ImportFrom. > > ? >>> import

Re: basic auth request

2021-08-22 Thread Chris Angelico
On Sun, Aug 22, 2021 at 6:45 PM Peter J. Holzer wrote: > > On 2021-08-22 05:04:43 +1000, Chris Angelico wrote: > > On Sun, Aug 22, 2021 at 4:55 AM Martin Di Paola > > wrote: > > > HTTPS ensures encryption so the content, including the Basic Auth > > > user

Re: basic auth request

2021-08-21 Thread Chris Angelico
On Sun, Aug 22, 2021 at 4:55 AM Martin Di Paola wrote: > > While it is correct to say that Basic Auth without HTTPS is absolutely > insecure, using Basic Auth *and* HTTPS is not secure either. > > Well, the definition of "secure" depends of your threat model. Yes. Which makes statements like

Re: on perhaps unloading modules?

2021-08-21 Thread Chris Angelico
On Sun, Aug 22, 2021 at 4:37 AM Hope Rouselle wrote: > > Greg Ewing writes: > > > On 21/08/21 1:36 pm, Hope Rouselle wrote: > >> I wish I could restrict their syntax too, though, but I fear that's > >> not possible. For instance, it would be very useful if I could > >> remove loops. > > > >

Re: basic auth request

2021-08-17 Thread Chris Angelico
On Wed, Aug 18, 2021 at 7:15 AM Barry wrote: > > > > > On 17 Aug 2021, at 19:25, Chris Angelico wrote: > > > > On Wed, Aug 18, 2021 at 4:16 AM Barry Scott wrote: > >> Oh and if you have the freedom avoid Basic Auth as its not secure at all. > >

Re: basic auth request

2021-08-17 Thread Chris Angelico
On Wed, Aug 18, 2021 at 4:16 AM Barry Scott wrote: > Oh and if you have the freedom avoid Basic Auth as its not secure at all. > That's usually irrelevant, since the alternative is most likely to be form fill-out, which is exactly as secure. If you're serving over HTTPS, the page is encrypted,

Re: Cyclic imports

2021-08-17 Thread Chris Angelico
On Wed, Aug 18, 2021 at 4:10 AM Barry Scott wrote: > > def allImports( self, module_name ): > for line in f: > words = line.strip().split() > if words[0:1] == ['import']: > all_imports.append( words[1] ) > This will work for a

Re: basic auth request

2021-08-17 Thread Chris Angelico
On Wed, Aug 18, 2021 at 3:04 AM Robin Becker wrote: > > While porting an ap from python2.7 to python3 I see this > > base64string = base64.b64encode('%s:%s' % (wsemail, wspassword)) > request.add_header("Authorization", "Basic %s" % base64string) > > in python3.x I find this works

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread Chris Angelico
On Tue, Aug 17, 2021 at 1:50 PM Eryk Sun wrote: > > On 8/16/21, Chris Angelico wrote: > > On Tue, Aug 17, 2021 at 11:44 AM Eryk Sun wrote: > > > >> Yes, the PC speaker beep does not get used in Windows 7+. The beep > >> device object is retained

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread Chris Angelico
On Tue, Aug 17, 2021 at 11:44 AM Eryk Sun wrote: > > On 8/16/21, Roel Schroeven wrote: > > > > We're not necessarily talking about the PC speaker here: (almost) all > > computers these days have sound cards (mostly integrated on the > > motherboard) that are much more capable than those one-bit

Re: on perhaps unloading modules?

2021-08-16 Thread Chris Angelico
On Tue, Aug 17, 2021 at 4:02 AM Greg Ewing wrote: > The second best way would be to not use import_module, but to > exec() the student's code. That way you don't create an entry in > sys.modules and don't have to worry about somehow unloading the > module. I would agree with this. If you need to

Re: some problems for an introductory python test

2021-08-16 Thread Chris Angelico
On Tue, Aug 17, 2021 at 3:51 AM Hope Rouselle wrote: > > Chris Angelico writes: > >> Wow, I kinda feel the same as you here. I think this justifies perhaps > >> using a hardware solution. (Crazy idea?! Lol.) > > > > uhhh Yes. Very crazy idea.

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-14 Thread Chris Angelico
On Sun, Aug 15, 2021 at 1:02 PM John O'Hagan wrote: > > > On 2021-08-13 17:17, Chris Angelico wrote: > > > Is it really? In my experience, no human ear can distinguish 277Hz > > > from 277.1826Hz when it's played on a one-bit PC speaker, which the > > > Beep

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-13 Thread Chris Angelico
On Sat, Aug 14, 2021 at 2:11 AM Terry Reedy wrote: > > On 8/13/2021 6:53 AM, Umang Goswami wrote: > > Hi There, Hope you find this mail in good health. > > > > I am Umang Goswami, a Python developer and student working on a huge > > project for automation of music instruments. I am producing the

Re: some problems for an introductory python test

2021-08-12 Thread Chris Angelico
On Fri, Aug 13, 2021 at 5:03 AM Grant Edwards wrote: > > On 2021-08-12, Hope Rouselle wrote: > > >> OS/2 had all kinds of amazing features (for its time). [...] Plus, > >> it had this fancy concept of "extended attributes"; on older > >> systems (like MS-DOS's "FAT" family), a file might be

Re: some problems for an introductory python test

2021-08-12 Thread Chris Angelico
On Fri, Aug 13, 2021 at 2:15 AM Hope Rouselle wrote: > > Chris Angelico writes: > > > History lesson! > > > > Once upon a time, IBM and Microsoft looked at what Intel was > > producing, and went, hey, we need to design an operating system that > > c

Re: Is there a better way to create a list of None objects?

2021-08-12 Thread Chris Angelico
On Thu, Aug 12, 2021 at 6:59 PM Stephen Tucker wrote: > > Hi, > > I thought I'd share the following piece of code that I have recently written > (a) to check that what I have done is reasonable - even optimum, > (b) to inform others who might be wanting to do similar things, and > (c) to invite

Re: some problems for an introductory python test

2021-08-11 Thread Chris Angelico
On Thu, Aug 12, 2021 at 9:23 AM Dennis Lee Bieber wrote: > > On Thu, 12 Aug 2021 06:15:28 +1000, Chris Angelico > declaimed the following: > > > >The default command interpreter and shell on OS/2 was fairly primitive > >by today's standards, and was highly com

Re: some problems for an introductory python test

2021-08-11 Thread Chris Angelico
On Thu, Aug 12, 2021 at 7:25 AM Rob Cliffe via Python-list wrote: > > On 11/08/2021 19:10, MRAB wrote: > > On 2021-08-11 18:10, Wolfram Hinderer via Python-list wrote: > >> > >> > >> Am 11.08.2021 um 05:22 schrieb Terry Reedy: > >>> Python is a little looser about whitespace than one might expect

Re: some problems for an introductory python test

2021-08-11 Thread Chris Angelico
On Thu, Aug 12, 2021 at 5:00 AM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Wed, Aug 11, 2021 at 4:18 AM Hope Rouselle > > wrote: > >> > >> Chris Angelico writes: > >> > >> [...] > >> > >> >> not di

Re: some problems for an introductory python test

2021-08-10 Thread Chris Angelico
On Wed, Aug 11, 2021 at 4:18 AM Hope Rouselle wrote: > > Chris Angelico writes: > > [...] > > >> not disagreeing... and yeah I could have thought deeper about the > >> answer, but I still think "notthing has been OOP" -> "yes it has, they

Re: some problems for an introductory python test

2021-08-10 Thread Chris Angelico
On Wed, Aug 11, 2021 at 4:18 AM Hope Rouselle wrote: > > I totally agree with you but I didn't know that even numbers were like > that in Python. In fact, I still don't quite believe it... > > >>> 2.__add__(3) > SyntaxError: invalid syntax Yeah, that's because "2." looks like the beginning of a

Re: some problems for an introductory python test

2021-08-10 Thread Chris Angelico
On Wed, Aug 11, 2021 at 4:14 AM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Tue, Aug 10, 2021 at 7:25 AM Hope Rouselle > > wrote: > >> I came up with the following question. Using strings of length 5 > >> (always), write a proced

Re: some problems for an introductory python test

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 1:41 PM Mats Wichmann wrote: > > > On 8/9/21 6:34 PM, Chris Angelico wrote: > > > If you want to highlight the OOP nature of Python, rather than looking > > at magic methods, I'd first look at polymorphism. You can add a pair > > of integers

Re: some problems for an introductory python test

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 8:19 AM Mats Wichmann wrote: > Even if you do > > x = 2 + 3 > > you're actually creating an integer object with a value of 2, and > calling its add method to add the integer object with the value of 3 to > it. The syntax hides it, but in a way it's just convenience that it

Re: some problems for an introductory python test

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 7:25 AM Hope Rouselle wrote: > I came up with the following question. Using strings of length 5 > (always), write a procedure histogram(s) that consumes a string and > produces a dictionary whose keys are each substrings (of the string) of > length 1 and their

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-09 Thread Chris Angelico
On Tue, Aug 10, 2021 at 7:24 AM Jack Brandom wrote: > > Greg Ewing writes: > > > On 6/08/21 12:00 pm, Jack Brandom wrote: > >> It seems > >> that I'd begin at position 3 (that's "k" which I save somewhere), then I > >> subtract 1 from 3, getting 2 (that's "c", which I save somewhere), then > >>

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Chris Angelico
On Sat, Aug 7, 2021 at 5:22 AM Boris Dorestand wrote: > > Jach Feng writes: > > >> > s = "Jack Brandom" > >> > s[3 : -13 : -1] > >> >> 'kcaJ' > >> >> I have no idea how to replace that -13 with a positive index. Is it > >> >> possible at all? > > That's not possible because a positive

Re: argparse: delimiter for argparse list arguments

2021-08-03 Thread Chris Angelico
On Wed, Aug 4, 2021 at 7:07 AM Sven R. Kunze wrote: > > It could be but I've seen them used somewhere else. > > I wouldn't bikeshed on this yet, as I haven't found a way to do this so > far. Let's imagine the following parser: > > parser.add_argument('things',action='append') >

Re: Importing modules with arguments

2021-07-30 Thread Chris Angelico
On Sat, Jul 31, 2021 at 5:11 AM Charles Smith wrote: > > First off, thanks for the answer. I don't see the cached module as a problem > here. If you provide arguments to a module, the goal is "most likely" to > alter/parameterize the behavior of the first import. Now, I agree that > behavior

Re: Importing modules with arguments

2021-07-30 Thread Chris Angelico
On Sat, Jul 31, 2021 at 3:48 AM Charles Smith wrote: > > I have found myself wanting to import module and provide arguments to them. > There's two main reason I could think of for this. First is to prevent a > circular import, though most of circular imports can be prevented by changing > the

Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Chris Angelico
On Fri, Jul 30, 2021 at 5:40 AM Terry Reedy wrote: > Since the 'two ways' involve the new :=, I have no idea what 'two ways' > and 'same result' you mean before :=. > I'm not sure, but I think that a lot of people read patch notes as if they say "this is how everyone needs to do things now", and

Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Chris Angelico
On Thu, Jul 29, 2021 at 7:49 PM ast wrote: > > Hello > > Reading PEP572 about Python 3.9 assignment expressions, > I discovered a subtle difference between any(a list) > and any(a generator) > > see: > > >>> lines = ["azerty", "#qsdfgh", "wxcvbn"] > >>> any((comment := line).startswith('#') for

Re: [Errno 2] No such file or directory:

2021-07-28 Thread Chris Angelico
On Thu, Jul 29, 2021 at 2:10 AM joseph pareti wrote: > > The following code fails as shown in the title: > > > > > > > *import subprocesscmd = 'ls -l > /media/joepareti54/Elements/x/finance-2020/AI/Listen_attend_spell/VCTK-Corpus/wav48 > | awk "{print $9 }"'process = subprocess.Popen([cmd], >

Re: Track 3.9 instead of 3.10?

2021-07-27 Thread Chris Angelico
On Wed, Jul 28, 2021 at 1:05 AM Skip Montanaro wrote: > > I have a development branch in my fork of python/cpython, the > register2 branch of https://github.com/smontanaro/cpython. As I am > dealing with virtual machine internals I've found the changes to the > virtual machine between 3.9 and

Re: Python and Ubuntu versions

2021-07-23 Thread Chris Angelico
On Sat, Jul 24, 2021 at 9:52 AM Cameron Simpson wrote: > > On 24Jul2021 09:22, Chris Angelico wrote: > >On Sat, Jul 24, 2021 at 9:03 AM Cameron Simpson wrote: > >> Rereading this, maybe I was unclear. This is for install directories > >> like /opt/Python-3.w

Re: Python and Ubuntu versions

2021-07-23 Thread Chris Angelico
On Sat, Jul 24, 2021 at 9:03 AM Cameron Simpson wrote: > > On 23Jul2021 19:51, Chris Angelico wrote: > >On Fri, Jul 23, 2021 at 7:48 PM Cameron Simpson wrote: > >> Do the build and install as yourself. I usually do the install step by > >> making the install di

Re: Python and Ubuntu versions

2021-07-23 Thread Chris Angelico
On Fri, Jul 23, 2021 at 7:48 PM Cameron Simpson wrote: > Do the build and install as yourself. I usually do the install step by > making the install directory as root, then chowning it to me. Then you > can do the install as you - this has the advantage the you're > unprivileged and can't

Re: argparse support of/by argparse

2021-07-23 Thread Chris Angelico
On Fri, Jul 23, 2021 at 5:34 PM Albert-Jan Roskam wrote: > > >>> [1] https://pypi.org/project/clize/ > > > I use and like docopt (https://github.com/docopt/docopt). Is clize a better > choice? > Not necessarily. Both are good. Explore both, see which one makes more sense. ChrisA --

Re: Python and Ubuntu versions

2021-07-23 Thread Chris Angelico
‪On Fri, Jul 23, 2021 at 2:55 PM ‫אורי‬‎ wrote:‬ > > Hi, > > I have a production server with Ubuntu 18.04 LTS (currently upgraded to > Ubuntu 18.04.5 LTS) and I use Python in virtualenv - currently Python > 3.6.9. I'm using Django and I read that from Django 4.0, a minimal version > of Python 3.8

<    4   5   6   7   8   9   10   11   12   13   >