Re: some problems for an introductory python test

2021-08-11 Thread Rob Cliffe via Python-list
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 from reading 'normal' code when the result is unambiguous in that it cannot r

RE: some problems for an introductory python test

2021-08-11 Thread Avi Gross via Python-list
This conversation has, of course, veered away from the original question so I am starting afresh. My memory of the original question is about how one sets up a test for material covered in class or associated materials for what sounds like a beginner class. I am not sure whether this would be the

Re: basic auth request

2021-08-17 Thread Jon Ribbens via Python-list
On 2021-08-17, Barry wrote: >> 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, and that includes the headers; if you're >> not, then it's not encrypted, and that includes the

Re: basic auth request

2021-08-18 Thread Jon Ribbens via Python-list
On 2021-08-18, Robin Becker wrote: > On 17/08/2021 22:47, Jon Ribbens via Python-list wrote: > ... >> That's only true if you're not using HTTPS - and you should *never* >> not be using HTTPS, and that goes double if forms are being filled >> in and d

Re: tkinter

2021-08-21 Thread Alan Gauld via Python-list
On 21/08/2021 19:37, Tony Genter wrote: >Tkinter stopped working overnight from 8/20/2021 to 8/21/2021. Last night >I was working on tutorials to work on a GUI and this morning every file >that uses tkinter is broken stating that no module `tkinter' exists. Are you sure you were runni

Re: Decoding of EmailMessage text

2021-08-23 Thread Jon Ribbens via Python-list
On 2021-08-23, Loris Bennett wrote: > If instead of > > mail.set_content(body) > > I do > > mail.set_content(body, cte="quoted-printable") Try print(mail.get_content()) rather than print(mail.as_string()) -- https://mail.python.org/mailman/listinfo/python-list

Why Pyto package not available yet ???

2021-08-23 Thread Steeve Kerou via Python-list
Hi,  Here is Pyto, the first animated character that help you Learn Python like you play video games Why not implement me on Python PyPI ??? Episode 1: Intro / Who is Pyto ? / The Idle World | Pytorial | | | | | | | | | | | Episode 1: Intro / Who is Pyto ? / The Idle World

Re: basic auth request

2021-08-25 Thread Jon Ribbens via Python-list
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 down of the threats I watch out for. >> >> The on-line world and the real-world are the same here. >> >> If a business ch

Re: basic auth request

2021-08-25 Thread Jon Ribbens via Python-list
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 >> being secure approaches zero - they are not all equal yet they are all >> equally truste

Re: basic auth request

2021-08-25 Thread Jon Ribbens via Python-list
On 2021-08-25, Chris Angelico wrote: > On Thu, Aug 26, 2021 at 12:48 AM Jon Ribbens via Python-list > wrote: >> Another attempt at combatting this problem is DNS CAA records, >> which are a way of politely asking all CAs in the world except the >> ones you choose "ple

Re: basic auth request

2021-08-25 Thread Jon Ribbens via Python-list
On 2021-08-25, Eli the Bearded <*@eli.users.panix.com> wrote: > In comp.lang.python, Jon Ribbens wrote: >> Another attempt at combatting this problem is DNS CAA records, >> which are a way of politely asking all CAs in the world except the >> ones you choose "please don't issue a certificate for

Re: on writing a while loop for rolling two dice

2021-08-28 Thread Alan Gauld via Python-list
On 28/08/2021 21:50, Hope Rouselle wrote: >>> roll_count = 0 >>> while True: >>> outcome = roll_two_dice() >>> roll_count += 1 >>> if outcome[ 0 ]== outcome[ 1 ]: break >>> return roll_count, outcome[ 0 ] >> > > Wait, I'm surprised ``outcome'' is still a valid name at the > return-sta

RE: on writing a while loop for rolling two dice

2021-08-28 Thread Avi Gross via Python-list
[1, 3, 1, 13, 11, 4, 3, 5, 2, 4] And the code can be a tad shorter, LOL! But obviously then you have more overhead than an iterative solution or one using a generator ... -----Original Message- From: Python-list On Behalf Of Alan Gauld via Python-list Sent: Saturday, August 28, 2021 6:52 PM To:

Python UI (was Re: urgent)

2021-08-30 Thread Alan Gauld via Python-list
On 29/08/2021 11:28, Hari wrote: > i was download ur python software but it is like boring user interface I agree it is a boring user interface. Just 3 chevrons: >>> You can change it a little if you want but ultimately its just an invitation to type commands. What kind of interface did you have

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 Alan Gauld via Python-list
On 31/08/2021 13:45, Chris Angelico wrote: > (I find the Ireland situation particularly amusing. Time zones and daylight saving arrangements in particular are a nightmare at the micro level. I once worked on a large customer support application which required all dates/times to be viewable in UT

RE: urgent (actually NOT urgent at all.)

2021-08-31 Thread Avi Gross via Python-list
This is a bit sillier then some other discussions here! There are many programs (especially back when more command-line programs were used) that presented default prompts like "$" and many or most of them let you over-ride it. Can someone tell this person that if >>> is not pleasing, they can d

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 Alan Gauld via Python-list
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 > the only way. Except for the places that don't follow the IANA scheme and/or dynamically change their time sett

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 Alan Gauld via Python-list
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 2 years back in the '70s and very quickly reverted to DST when they realized that the number of fatalities amo

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 Alan Gauld via Python-list
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't exist ("we always change at 2AM"), but in Europe, they try to > synchronize for the convenience of commerce

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 Alan Gauld via Python-list
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 >> you need the ability to manually override too. >> > > What places are those? Mainly small non-tech oriented places

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 Alan Gauld via Python-list
On 02/09/2021 20:11, MRAB wrote: >> In one of them (I can't recall which is which) they change on the 4th >> weekend of October/March in the other they change on the last weekend. >> >> > In the EU (and UK) it's the last Sunday in March/October. > > In the US it's second Sunday in March and the 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-03 Thread Alan Gauld via Python-list
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 accidents while crossing roads jumped. > > How do they manage in winter? That was the winter. Sunrise wasn't till 10:00 or

Re: Problem with python

2021-09-04 Thread Rob Cliffe via Python-list
Well, up to a point. In Python 2 the output from     print 1, 2 is '1 2' In Python 3 if you add brackets:     print(1, 2) the output is the same. But if you transplant that syntax back into Python 2, the output from     print(1, 2) is '(1, 2)'.  The brackets have turned two separate items into a s

CPython / Decimal and bit length of value.

2021-09-04 Thread Nacnud Nac via Python-list
Hi, Is there a quick way to get the number of bits required to store the value in a Decimal class?  What obvious thing am I missing? I'm working with really large integers, say, in the order of 5_000_000 of ASCII base 10 digits.  It seems the function mpd_sizeinbase would be a nice thing to be ab

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 Alan Gauld via Python-list
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 traffic accidents while crossing roads jumped. > > Are you saying that you had DST in winter, or that, when summer *and* > DST

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
For some people the "while true" method seems reasonable but it has a problem if the internal body does not have some guarantee of an exit. And that exit can be subtle. Many have mentioned ways an end condition can fail due to rounding errors not being exactly equal to what you are looking for, or

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
I actually like it if a language lets you spell out your intention, although adding many keywords is not a plus. So, yes something like: loop ... end loop; Is appealing as it makes clear the decision on when to exit the loop must be within the loop (or till some

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
Let me add something, Stefan. Some people just want to get a job done. For this person, he had a very specific need for a one-time project where the rest of it was understood but one small step was confusing. Frankly, he could have done it faster by opening a text editor on something like a CSV fil

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
[email protected] Subject: Re: on writing a while loop for rolling two dice On 2021-09-06 at 20:11:41 -0400, Avi Gross via Python-list wrote: > And in the python version, has anyone made a generator that returned > NULL or the like so you can say uselessly: > > for ( _ in forever(

RE: on writing a while loop for rolling two dice

2021-09-06 Thread Avi Gross via Python-list
It has been nearly three decades since I have had to write in C, Stefan, but what I suggested jokingly is quite mild compared to what the winners of the obfuscated C Contest do: https://www.ioccc.org/ Time for me to drop out of this thread. Personally I fully agree uses of "while' as described ar

RE: on writing a while loop for rolling two dice

2021-09-07 Thread Avi Gross via Python-list
alister via Python-list Sent: Tuesday, September 7, 2021 2:58 PM To: [email protected] Subject: Re: on writing a while loop for rolling two dice On Tue, 07 Sep 2021 14:53:29 +, Grant Edwards wrote: > On 2021-09-06, Stefan Ram wrote: >> "Avi Gross" writes: >&g

Re: on writing a while loop for rolling two dice

2021-09-07 Thread Alan Gauld via Python-list
On 07/09/2021 15:53, Grant Edwards wrote: > I remember engineering manager I worked with about 35 years ago who > used a set of C macros to try to make his code look as much like BASIC > as possible: > > #define IF if ( > #define THEN ) { > #define ELSE } else { > #define ENDIF } > ...

RE: on writing a while loop for rolling two dice

2021-09-07 Thread Avi Gross via Python-list
Greg, Yes, a smart person may come up with such tricks but a really smart person, in my view, adjusts. With some exceptions, such as when trying to port existing code to a new language quickly, someone who is not too obsessive will try to pick up the goals and spirit of a new language and use them

RE: on writing a while loop for rolling two dice

2021-09-07 Thread Avi Gross via Python-list
Python-list wrote: > and similarly changes any function imported directly to also be fully > qualified. One danger with this is that it can actual change the behavior of the program. Maybe more likely with global objects than functions, but still an issue. Remember, "from module impor

RE: on writing a while loop for rolling two dice

2021-09-08 Thread Avi Gross via Python-list
Charles, This forum is for python discussions so I will clarify that there is nothing wrong with making up a new language, including by bootstrapping an old language. But why not call it new and do not try to confuse people using the old. Python has grown and added much over the years and even ha

Re: Change the display style of the text on the STACKLINE.

2021-09-09 Thread Roland Mueller via Python-list
Hello to 9. syysk. 2021 klo 6.53 [email protected] ([email protected]) kirjoitti: > I'm using the following code in my forked project [1]: > > percol.view.STACKLINE = 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s Dir:M-d > Dircmd:M-b' > > I would like to change the display style of the text men

Re: Change the display style of the text on the STACKLINE.

2021-09-09 Thread Roland Mueller via Python-list
pe 10. syysk. 2021 klo 8.53 [email protected] ([email protected]) kirjoitti: > On Thursday, September 9, 2021 at 8:57:37 PM UTC+8, Roland Mueller wrote: > > Hello > > > > to 9. syysk. 2021 klo 6.53 [email protected] ([email protected]) > > kirjoitti: > > > I'm using the following code in my

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 09/09/2021 22:36, dn via Python-list wrote: > Even in fairly modest Python constructs, we quickly repeal the one-in, > one-out philosophy because try...except operates by providing another > exit-path. Exceptions are exceptional by their nature (or should be!) As such they can ar

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 10/09/2021 00:47, Terry Reedy wrote: > even one loop is guaranteed.) "do-while" or "repeat-until is even rarer > since fractional-loop include this as a special case. Is there any empirical evidence to support this? Or is it just a case of using the tools that are available? In my experience

Re: Friday Finking: Contorted loops

2021-09-10 Thread Alan Gauld via Python-list
On 10/09/2021 16:36, MRAB wrote: >> while...else... >> >> executes the else if the body of the loop does NOT get executed. >> >> for...else... >> >> executes the else iff ALL iterations of the for loop DO complete. >> > [snip] > > In both cases, it executes the 'else' part if it didn't break out

Re: Change the display style of the text on the STACKLINE.

2021-09-10 Thread Roland Mueller via Python-list
pe 10. syysk. 2021 klo 17.22 Greg Ewing ([email protected]) kirjoitti: > On 10/09/21 6:11 pm, Roland Mueller wrote: > > When I call print(s) it even shows ABCD and D is underscored. But > copying > > the output to mail looses the underscore ... > > If the terminal understands unicode, C

RE: Friday Finking: Contorted loops

2021-09-10 Thread Avi Gross via Python-list
over and over for "if" statements and perhaps some kind of case/switch statement and while loops and so on, may be parsimonious but ... -Original Message- From: Python-list On Behalf Of Alan Gauld via Python-list Sent: Friday, September 10, 2021 11:58 AM To: python-list@pytho

RE: Friday Finking: Contorted loops

2021-09-10 Thread Avi Gross via Python-list
In this discussion, I shudder to mention that people often simply use all kinds of additional logic to get a result. How much code have you seen that has some variable like "completed = False" that can be set to True in multiple places and many areas inside the loop are enclosed in an IF stateme

ANN: Version 0.5.1 of the Python config module has been released.

2021-09-11 Thread Vinay Sajip via Python-list
What Does It Do? The CFG configuration format is a text format for configuration files which is similar to, and a superset of, the JSON format.It has the following aims: * Allow a hierarchical configuration scheme with support for key-value mappings and   lists. * Support cross-

Re: Friday Finking: Contorted loops

2021-09-11 Thread Alan Gauld via Python-list
On 10/09/2021 19:49, Stefan Ram wrote: > Alan Gauld writes: >> OK, That's a useful perspective that is at least consistent. >> Unfortunately it's not how beginners perceive it > ... > > Beginners perceive it the way it is explained to them by > their teacher. I'm not sure that's true. Most

RE: Friday Finking: Contorted loops

2021-09-11 Thread Avi Gross via Python-list
SE statements each with another WHILE. But is that an ideal way to do this or perhaps instead use some variant of a switch statement or a dictionary pointing to functions to invoke or something. Time to go do something lese of even minor usefulness! -Original Message- From: Python-list O

RE: Friday Finking: Contorted loops

2021-09-11 Thread Avi Gross via Python-list
methods too like map/reduce or vectorized operations? -Original Message- From: Python-list On Behalf Of Peter J. Holzer Sent: Saturday, September 11, 2021 10:42 AM To: [email protected] Subject: Re: Friday Finking: Contorted loops On 2021-09-10 12:26:24 +0100, Alan Gauld via Python

Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
On 11/09/2021 15:41, Peter J. Holzer wrote: > How is C's do/while loop more horrible than Pascal's repeat/until? Because it is very hard to spot or distinguish from a normal while loop. while condition ; Is a valid (and fairly common) loop in C so code that has do{ code } while condition; L

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
: Sunday, September 12, 2021 5:44 AM To: [email protected] Subject: Re: Friday Finking: Contorted loops On 2021-09-11 21:38:02 -0400, Avi Gross via Python-list wrote: > Peter, in your own personal finite sample, I am wondering what you > might do TODAY if you looked at your loops aga

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
Stefan, Agreed that writing code to handle all possible eventualities is usually overkill and results in bloated software delivered very late or not at all. My point is that often OTHERS start adding requests afterward that seem trivial to THEM as they have no idea what it takes. I have often don

Re: ANN: Version 0.5.1 of the Python config module has been released.

2021-09-12 Thread Vinay Sajip via Python-list
Many of those 4.8K "users" might be using indirectly via some other dependency - I'm not sure how GitHub calculates "used by", but even if it were a direct dependency, one has no idea if it's actually being used or not. so I tend not to worry about such things. My distlib library has only 2 star

RE: Friday Finking: Contorted loops

2021-09-12 Thread Avi Gross via Python-list
8:22 -0700, [email protected] wrote: > On 2021-09-11 at 18:21:17 +0100, > Alan Gauld via Python-list wrote: > > On 11/09/2021 15:41, Peter J. Holzer wrote: > > > How is C's do/while loop more horrible than Pascal's repeat/until? [...] > > so code

Re: Friday Finking: Contorted loops

2021-09-12 Thread Alan Gauld via Python-list
On 12/09/2021 09:11, jak wrote: > if the only way to terminate a 'while True' loop is by using the 'break' > statement, why is it allowed to add the 'else' statement which will only > contain dead code? > > while True: > break > else: > print('dead code') > Because to the interpreter

RE: Friday Finking: Contorted loops

2021-09-13 Thread Avi Gross via Python-list
on.org Subject: Re: Friday Finking: Contorted loops On 2021-09-12 17:11:58 -0400, Avi Gross via Python-list wrote: > Yes, large units of code, and even smaller ones, may be a chore to > figure out. Arguably harder when you use indentation and the next/last > parts are not even on the same scr

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

2021-09-16 Thread Avi Gross via Python-list
Some questions make no sense to me. Can a kind of snake solve Sudoku? Do you mean a specific puzzle, or any puzzle or even a puzzle with no solution? Can a programming language do it? Well, in my experience, programming languages are tools to be used by humans, or sometimes by other programming

Re: Question again

2021-09-16 Thread Alan Gauld via Python-list
On 16/09/2021 06:50, af kh wrote: > Hello, > I was doing some coding on a website called replit I have no idea what that is but... > after answering 'no' or 'yes' after the last sentence I wrote, > the Python window shut off, That's what you told it to do in the code. Regardless of which answe

RE: Question again

2021-09-16 Thread Avi Gross via Python-list
- From: Python-list On Behalf Of Alan Gauld via Python-list Sent: Thursday, September 16, 2021 8:11 PM To: [email protected] Subject: Re: Question again On 16/09/2021 06:50, af kh wrote: > Hello, > I was doing some coding on a website called replit I have no idea what that

How to "cast" an object to a derived class?

2021-09-18 Thread Robert Latest via Python-list
Hi all, let's assume I'm using a module that defines some class "Opaque" and also a function that creates objects of that type. In my program I subclass that type because I want some extra functionality. But how can I "promote" a given Opaque instance to the derived class? Of course I could just cr

Re: How to "cast" an object to a derived class?

2021-09-18 Thread Robert Latest via Python-list
Stefan Ram wrote: > Robert Latest writes: But how can I "promote" a >>given Opaque instance to the derived class? > > Sometimes, one can use containment instead of inheritance. Nah, doesn't work in my case. I'm trying to write a wrapper around xml.etree.ElemenTree and .Element to circu

Re: Inheriting from str

2021-09-20 Thread Jon Ribbens via Python-list
On 2021-09-20, ast wrote: > Hello > > class NewStr(str): > def __init__(self, s): > self.l = len(s) > > Normaly str is an immutable type so it can't be modified > after creation with __new__ > > But the previous code is working well > > obj = NewStr("qwerty") > obj.l > 6 > > I don't und

Re: XML Considered Harmful

2021-09-21 Thread Jon Ribbens via Python-list
On 2021-09-21, Michael F. Stemper wrote: > On the prolog thread, somebody posted a link to: > > > One thing that it tangentially says is "XML is not the answer." > > I read this page right when I was about to write an XML parser > to get data

Re: XML Considered Harmful

2021-09-21 Thread Jon Ribbens via Python-list
On 2021-09-21, Pete Forman wrote: > CSV is quite good as a lowest common denominator exchange format. I say > quite because I would characterize it by 8 attributes and you need to > pick a dialect such as MS Excel which sets out what those are. XML and > JSON are controlled much better. You can ea

Re: Free OCR package in Python and selecting appropriate widget for the GUI

2021-09-22 Thread Roland Mueller via Python-list
Hello, ti 21. syysk. 2021 klo 16.53 Mohsen Owzar ([email protected]) kirjoitti: > Hi Guys > Long time ago I've written a program in Malab a GUI for solving Sudoku > puzzles, which worked not so bad. > Now I try to write this GUI with Python with PyQt5 or TKinter. > First question is: > Is t

ANN: distlib 0.3.3 released on PyPI

2021-09-22 Thread Vinay Sajip via Python-list
I've recently released version 0.3.3 of distlib on PyPI [1]. For newcomers, distlib is a library of packaging functionality which is intended to be usable as the basis for third-party packaging tools. The main changes in this release are as follows: * Fixed #152: Removed splituser() function whic

RE: XML Considered Harmful

2021-09-23 Thread Avi Gross via Python-list
Can we agree that there are way more general ways to store data than anything currently in common use and that in some ways, CSV and cousins like TSV are a subset of the others in a sense? There are trees and arbitrary graphs and many complex data structures often encountered while a program is run

RE: XML Considered Harmful

2021-09-23 Thread Avi Gross via Python-list
What you are describing Stephen, is what I meant by emulating a relational database with tables. And, FYI, There is no guarantee that two authors with the same name will not be assumed to be the same person. Besides the lack of any one official CSV format, there are oodles of features I have s

Re: XML Considered Harmful

2021-09-23 Thread Jon Ribbens via Python-list
On 2021-09-23, Stefan Ram wrote: > The real problem with CSV is that there is no CSV. > > This is not a specific data language with a specific > specification. Instead it is a vague designation for > a plethora of CSV dialects, which usually dot not even > have a specification. Indeed.

Type annotation pitfall

2021-09-23 Thread Robert Latest via Python-list
Hi all, this just caused me several hours of my life until I could whittle it down to this minimal example. Simple question: Why is the x member of object "foo" modified by initializing "bar"? Obviously, initializing foo with None doesn't set foo.x at all. So I guess x stays a class property, not

Re: XML Considered Harmful

2021-09-23 Thread Mike Dewhirst via Python-list
phone) Original message From: dn via Python-list Date: 24/9/21 15:42 (GMT+10:00) To: [email protected] Subject: Re: XML Considered Harmful On 24/09/2021 14.07, Stefan Ram wrote:> dn writes:>> With that, why not code it as Python expressions, and include the mod

Re: XML Considered Harmful

2021-09-24 Thread Jon Ribbens via Python-list
On 2021-09-24, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 8:53 AM dn via Python-list > wrote: >> On 25/09/2021 06.59, Peter J. Holzer wrote: >> > CSV: Good for tabular data of a single data type (strings). As soon as >> > there's a second data type (numb

Re: XML Considered Harmful

2021-09-25 Thread Jon Ribbens via Python-list
On 2021-09-25, Peter J. Holzer wrote: > On 2021-09-24 23:32:47 -, Jon Ribbens via Python-list wrote: >> JSON Schema provides a way to denote composite types. > > I probably wasn't clear what I meant. In XML, every element has a tag, > which is basically its type. So by

Could not initilalize crash reporting DB

2021-09-25 Thread Sir Real via Python-list
I have a script that chooses a paragraph at random from a text file then uses that paragraph to generate and send an email message. It's set up to run on Windows 7 startup. It has run without issue more than 400 times. Recently two consecutive runs produced the following messages... Could

RE: XML Considered Harmful

2021-09-25 Thread Avi Gross via Python-list
Michael, I don't care what you choose. Whatever works is fine for an internal use. But is the data scheme you share representative of your actual application? >From what I see below, unless the number of "point" variables is not always exactly four, the application might be handled well by any f

RE: XML Considered Harmful

2021-09-27 Thread Avi Gross via Python-list
Michael, Given your further explanation, indeed reading varying numbers of points in using a CSV is not valid, albeit someone might just make N columns (maybe a few more than 7) to handle a hopefully worst case. Definitely it makes more sense to read in a list or other data structure. You keep ta

RE: XML Considered Harmful

2021-09-28 Thread Avi Gross via Python-list
I replied to Michael privately but am intrigued by his words here: "The thing that creates realistic test cases is my brain." I consider extensions to my brain to include using a language like Python on my computer and in particular, to take a model I think of and instantiate it. Lots of people h

RE: XML Considered Harmful

2021-09-28 Thread Avi Gross via Python-list
400, Avi Gross via Python-list wrote: >> You keep talking about generators, though. If the generators are >> outside of your program, then yes, you need to read in whatever they produce. > > As I understood it, the "generators" don't generate the data, they are >

RE: XML Considered Harmful

2021-09-28 Thread Avi Gross via Python-list
Not lucky at all, Michael. The problem is he published a number of things with Paul Erdős a few years after I got my degrees and went to Bell laboratories. I never met Erdős but he was prolific and had 507 people publish with him as co-authors. I would have loved to as I also speak languages he spo

RE: XML Considered Harmful

2021-09-29 Thread Avi Gross via Python-list
I think that to make electricity comprehend, you need a room temperature superconductor. The Cooper Pairs took a while to comprehend but now ... I think, seriously, we have established the problems with guessing that others are using the language in a way we assume. So how many comprehensions do

Re: OT: AttributeError

2021-09-29 Thread Rob Cliffe via Python-list
+1000, Chris Angelico wrote: On Wed, Sep 29, 2021 at 9:10 AM <[email protected]> wrote: On 2021-09-29 at 11:38:22 +1300, dn via Python-list wrote: For those of us who remember/can compute in binary, octal, hex, or decimal as-needed: Why do programmers confuse

RE: How to pass a method as argument?

2021-09-30 Thread Avi Gross via Python-list
Sounds like an excellent homework question. But your method of using an object is not what first comes to mind based on your cursory description. There is a python idiom using functional programming that looks like this: def doit(a, b, fun): return(fun(a,b)) So make up your own function

pythonpapers.org domain name to lapse in November

2021-10-04 Thread Mike Dewhirst via Python-list
The board of editors of the Python Papers has decided to let the pythonpapers.org domain name to lapse. It will not be renewed in November. Anyone interested in it can get in touch. Cheers Mike -- Signed email is an absolute defence against phishing. This email has been signed with my privat

Big jump in version

2021-10-05 Thread Cecil Westerhof via Python-list
When I run: pip3 list --outdated I get: Package Version Latest Type --- -- - cryptography 3.4.8 35.0.0 wheel pyzstd 0.14.4 0.15.0 wheel The jump from 3 to 35 seems a bit excessive to me. Or is it correct? On a side node. I have not upda

RE: Understanding the working mechanis of python unary arithmetic operators.

2021-10-05 Thread Avi Gross via Python-list
another. Here are examples I just typed: +1 1 +1 1 +-+-+-1 -1 ---1 -1 --1 1 Luckily since Python has no ++ or -- pre or post operators, these are legal, albeit a tad weird. -Original Message- From: Python-list On Behalf Of dn via Python-list Sent: Tuesday, October 5, 2021 7:11 PM To

Re: Big jump in version

2021-10-07 Thread Cecil Westerhof via Python-list
Grant Edwards writes: > On 2021-10-04, Cecil Westerhof via Python-list wrote: >> When I run: >> pip3 list --outdated >> >> I get: >> Package Version Latest Type >> --- -- - >> cryptography 3.4.8 35.0.0

RE: Re: sum() vs. loop

2021-10-12 Thread Avi Gross via Python-list
Alan, I am also wondering about that zip() function call to bind the two lists into a sort of iterator object. Presumably that calls the iterator N times. I did a test where I made two list called A and B and used zip to make an object holding the two and then removed A and B. I was able to print

RE: sum() vs. loop

2021-10-13 Thread Avi Gross via Python-list
Yes, Stefan, I realized that and did not test more thoroughly. Chris pointed it out too. I indeed deleted the names but a second reference remained so I may be wrong and the function may just keep track of the position and return one tuple at a time. That would be a good design, unless there was a

Re: importing a module from a file without the '.py' suffix

2021-10-22 Thread Rob Cliffe via Python-list
As far as I know, it can't be done. If I was REALLY desperate I might try (tested) import os os.rename('myfile.myext', 'myfile.py') import myfile os.rename('myfile.py', 'myfile.myext') # with appropriate modifications if myfile is not in the current directory but this is a horrible solution, sub

Re: New assignmens ...

2021-10-22 Thread Jon Ribbens via Python-list
On 2021-10-22, Stefan Ram wrote: > Paulo da Silva writes: >>Why doesn't this work >> if (self.ctr:=self.ctr-1)<=0: >>while this works >> if (ctr:=ctr-1)<=0: > > assignment_expression ::= [identifier ":="] expression, > but the attribute references "self.ctr" is no identifier! This

Re: New assignmens ...

2021-10-23 Thread Jon Ribbens via Python-list
On 2021-10-23, Chris Angelico wrote: > I've never used ctr:=ctr-1 either, though, so I don't know the actual > use cases. Why is this being used in an assignment expression? Is it > an ersatz loop? > > Common use-cases include: > > if m := re.match(...): > > while data := thing.read(): > > etc. Al

Re: New assignmens ...

2021-10-23 Thread Jon Ribbens via Python-list
On 2021-10-23, Chris Angelico wrote: > On Sun, Oct 24, 2021 at 4:39 AM Jon Ribbens via Python-list > wrote: >> On 2021-10-23, Chris Angelico wrote: >> > In what situations do you need to mutate an attribute and also test >> > it, and how much hassle is it to simp

RE: New assignmens ...

2021-10-24 Thread Avi Gross via Python-list
No, many things need not be as general as possible once you consider how much work it may take to develop code and how many bugs and oddities might be introduced and even how much it may slow the interpreter. I could make an argument that everywhere you can put in a character string should also al

Re: [tkinter][Windows]Unexpected state report for the tab key

2021-10-25 Thread Rob Cliffe via Python-list
On 25/10/2021 02:57, Stefan Ram wrote: GetKeyState still returns that the tab key is pressed after the tab key already has been released. Well, how then am I going to make my slide show stop the moment the key is being released? Does tkinter allow you to trap KeyUp (and KeyDown) ev

RE: New assignmens ...

2021-10-25 Thread Avi Gross via Python-list
paste operation for the more complex scenarios even if they remember the fancy version exists and is bound to some forgotten series of keys clicked together like control-X control-alt-t or something. -Original Message- From: Python-list On Behalf Of Antoon Pardon Sent: Monday, October 2

RE: New assignmens ...

2021-10-25 Thread Avi Gross via Python-list
We have had discussions debating if Python is a good language for teaching. The short answer is NO unless you only teach a small subset and the students know there is more they can learn as needed. The language is too rich and has too many ways to do seemingly anything and that is before you add mo

RE: Beginner in python

2021-10-25 Thread Avi Gross via Python-list
Chris, I was just about to suggest: 1+3+5+7+9 and 50*101 but that would mean helping with what does seem like fairly simple homework with no effort to show us what they already tried and got stuck with! So, ignore my attempts at trivial humor as I suspect some form of loop was anticipated.

RE: New assignmens ...

2021-10-25 Thread Avi Gross via Python-list
Stefan, Yes, I often pass even fairly trivial functions like "add" or "+" or whatever the language makes me say, to other functions in various forms of functional programing. My point is that my example may seem trivial and not necessary as an EXAMPLE of the greater point that may be easier to und

RE: Create a contact book

2021-10-26 Thread Avi Gross via Python-list
Chris, I think it is time someone set up a business where they do the homework for people for a mere $1,000 or so per hour. Anonymously, of course. And we can refer requests for free homework advice there. Maybe the answer to this request is to suggest they use FACEBOOK which seemingly keeps you

RE: New assignmens ...

2021-10-27 Thread Avi Gross via Python-list
I think anyone who suggests we should separate costs from benefits belongs securely within the academic world and should remain there. Practical things need to be built considering costs. Theoretical things, sure, cost is not an issue. Python is not only a real-world set of applications but an ev

RE: Create a contact book

2021-10-27 Thread Avi Gross via Python-list
normally have enough local help. -Original Message- From: Python-list On Behalf Of dn via Python-list Sent: Wednesday, October 27, 2021 12:15 AM To: [email protected] Subject: Re: Create a contact book On 27/10/2021 04.16, Avi Gross via Python-list wrote: > Chris, > > I thin

RE: New assignmens ...

2021-10-27 Thread Avi Gross via Python-list
Of dn via Python-list Sent: Wednesday, October 27, 2021 4:38 AM To: [email protected] Subject: Re: New assignmens ... On 24/10/2021 22.23, O365 Dict wrote: > Well I have the following use case: > > while (temp_result := calculate_next_couple(a, b))[1]: > a, b =

<    24   25   26   27   28   29   30   31   32   33   >