From hugo at python.org Wed May 7 13:41:29 2025 From: hugo at python.org (Hugo van Kemenade) Date: Wed, 7 May 2025 20:41:29 +0300 Subject: Python 3.14.0 beta 1 is here! Message-ID: Only one day late, welcome to the first beta! https://www.python.org/downloads/release/python-3140b1/ This is a beta preview of Python 3.14 Python 3.14 is still in development. This release, 3.14.0b1, is the first of four planned beta releases. Beta release previews are intended to give the wider community the opportunity to test new features and bug fixes and to prepare their projects to support the new feature release. We strongly encourage maintainers of third-party Python projects to test with 3.14 during the beta phase and report issues found to the Python bug tracker as soon as possible (https://github.com/python/cpython/issues). While the release is planned to be feature-complete entering the beta phase, it is possible that features may be modified or, in rare cases, deleted up until the start of the release candidate phase (Tuesday 2025-07-22). Our goal is to have no ABI changes after beta 4 and as few code changes as possible after the first release candidate. To achieve that, it will be extremely important to get as much exposure for 3.14 as possible during the beta phase. Please keep in mind that this is a preview release and its use is not recommended for production environments. Major new features of the 3.14 series, compared to 3.13 Some of the major new features and changes in Python 3.14 are: New features - PEP 649: The evaluation of type annotations is now deferred, improving the semantics of using annotations. - PEP 750: Template string literals (t-strings) for custom string processing, using the familiar syntax of f-strings. - PEP 784: A new module compression.zstd providing support for the Zstandard compression algorithm. - PEP 758: except and except* expressions may now omit the brackets. - Syntax highlighting in PyREPL, and support for color in unittest, argparse, json and calendar CLIs. - PEP 768: A zero-overhead external debugger interface for CPython. - UUID versions 6-8 are now supported by the uuid module, and generation of versions 3-5 and 8 are up to 40% faster. - PEP 765: Disallow return/break/continue that exit a finally block. - PEP 741: An improved C API for configuring Python. - A new type of interpreter. For certain newer compilers, this interpreter provides significantly better performance. Opt-in for now, requires building from source. - Improved error messages. - Builtin implementation of HMAC with formally verified code from the HACL* project. For more details on the changes to Python 3.14, see What?s new in Python 3.14. https://docs.python.org/3.14/whatsnew/3.14.html The next pre-release of Python 3.14 will be 3.14.0b2, scheduled for 2025-05-27. Build changes - PEP 761: Python 3.14 and onwards no longer provides PGP signatures for release artifacts. Instead, Sigstore is recommended for verifiers. - Official macOS and Windows release binaries include an experimental JIT compiler. Incompatible changes, removals and new deprecations - https://docs.python.org/3.14/whatsnew/3.14.html#incompatible-changes - https://docs.python.org/3.14/whatsnew/3.14.html#removed - https://docs.python.org/3.14/whatsnew/3.14.html#deprecated - https://docs.python.org/3.14/whatsnew/3.14.html#c-api-removed - https://docs.python.org/3.14/whatsnew/3.14.html#c-api-deprecated Python install manager The installer we offer for Windows is being replaced by our new install manager, which can be installed from the Windows Store or our FTP page. See our documentation for more information. The JSON file available for download below contains the list of all the installable packages available as part of this release, including file URLs and hashes, but is not required to install the latest release. The traditional installer will remain available throughout the 3.14 and 3.15 releases. More resources - Online documentation: https://docs.python.org/3.14/ - PEP 745, 3.14 Release Schedule: https://peps.python.org/pep-0745/ - Report bugs at https://github.com/python/cpython/issues - Help fund Python and its community: https://www.python.org/psf/donations/ Note During the release process, we discovered a test that only failed when run sequentially and only when run after a certain number of other tests. This appears to be a problem with the test itself, and we will make it more robust for beta 2. For details, see https://github.com/python/cpython/issues/133532 And now for something completely different The mathematical constant pi is represented by the Greek letter ? and represents the ratio of a circle?s circumference to its diameter. The first person to use ? as a symbol for this ratio was Welsh self-taught mathematician William Jones in 1706. He was a farmer?s son born in Llanfihangel Tre?r Beirdd on Angelsy (Ynys M?n) in 1675 and only received a basic education at a local charity school. However, the owner of his parents? farm noticed his mathematical ability and arranged for him to move to London to work in a bank. By age 20, he served at sea in the Royal Navy, teaching sailors mathematics and helping with the ship?s navigation. On return to London seven years later, he became a maths teacher in coffee houses and a private tutor. In 1706, Jones published Synopsis Palmariorum Matheseos which used the symbol ? for the ratio of a circle?s circumference to diameter. Jones was also the first person to realise ? is an irrational number, meaning it can be written as a decimal number that goes on forever, but cannot be written as a fraction of two integers. But why ?? It?s thought Jones used the Greek letter ? because it?s the first letter in perimetron or perimeter. Jones was the first to use ? as our familiar ratio but wasn?t the first to use it in as part of the ratio. William Oughtred, in his 1631 Clavis Mathematicae (The Key of Mathematics), used ?/? to represent what we now call pi. His ? was the circumference, not the ratio of circumference to diameter. James Gregory, in his 1668 Geometriae Pars Universalis (The Universal Part of Geometry) used ?/? instead, where ? is the radius, making the ratio 6.28? or ?. After Jones, Leonhard Euler had used ? for 6.28?, and also p for 3.14?, before settling on and popularising ? for the famous ratio. Enjoy the new release Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organisation contributions to the Python Software Foundation. Regards from Helsinki as the leaves begin to appear on the trees, Your release team, Hugo van Kemenade Ned Deily Steve Dower ?ukasz Langa From bob at mellowood.ca Wed May 7 23:20:27 2025 From: bob at mellowood.ca (Bob van der Poel) Date: Wed, 7 May 2025 20:20:27 -0700 Subject: backslash in triple quoted string Message-ID: Did something change in python buggering up my use of a "\ " sequence in a triple quoted string? I have yet to go through my archive on the program, but I tried to run it today and it crashed quite spectacularly when it hit a """ .... """ line being used as a comment at the top of a function. I changed the "\" to a "/" and all is well now. -- **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** Bob van der Poel ** Wynndel, British Columbia, CANADA ** EMAIL: bob at mellowood.ca WWW: http://www.mellowood.ca From olegsivokon at gmail.com Thu May 8 01:54:34 2025 From: olegsivokon at gmail.com (Left Right) Date: Thu, 8 May 2025 07:54:34 +0200 Subject: backslash in triple quoted string In-Reply-To: References: Message-ID: I think it could be this: A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+\.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.) Found in: https://docs.python.org/3/whatsnew/3.12.html#other-language-changes It's not supposed to crash your program though. If the program crashes because of it, it's a bug in Python. On Thu, May 8, 2025 at 7:00?AM Bob van der Poel via Python-list wrote: > > Did something change in python buggering up my use of a "\ " sequence in a > triple quoted string? > > I have yet to go through my archive on the program, but I tried to run it > today and it crashed quite spectacularly when it hit a """ .... """ line > being used as a comment at the top of a function. I changed the "\" to a > "/" and all is well now. > > > -- > > **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** > Bob van der Poel ** Wynndel, British Columbia, CANADA ** > EMAIL: bob at mellowood.ca > WWW: http://www.mellowood.ca > -- > https://mail.python.org/mailman/listinfo/python-list From olegsivokon at gmail.com Thu May 8 02:05:54 2025 From: olegsivokon at gmail.com (Left Right) Date: Thu, 8 May 2025 08:05:54 +0200 Subject: backslash in triple quoted string In-Reply-To: References: Message-ID: Also, it appears that the change linked above is a lie: https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-longstringitem According to the grammar, any character can follow backslash in a valid Python program. The warning / error raised by this code should not be a syntax error / warning because the syntax is correct. On Thu, May 8, 2025 at 7:54?AM Left Right wrote: > > I think it could be this: > > A backslash-character pair that is not a valid escape sequence now > generates a SyntaxWarning, instead of DeprecationWarning. For example, > re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid > escape sequence, use raw strings for regular expression: > re.compile(r"\d+\.\d+")). In a future Python version, SyntaxError will > eventually be raised, instead of SyntaxWarning. (Contributed by Victor > Stinner in gh-98401.) > > Found in: > https://docs.python.org/3/whatsnew/3.12.html#other-language-changes > > It's not supposed to crash your program though. If the program crashes > because of it, it's a bug in Python. > > On Thu, May 8, 2025 at 7:00?AM Bob van der Poel via Python-list > wrote: > > > > Did something change in python buggering up my use of a "\ " sequence in a > > triple quoted string? > > > > I have yet to go through my archive on the program, but I tried to run it > > today and it crashed quite spectacularly when it hit a """ .... """ line > > being used as a comment at the top of a function. I changed the "\" to a > > "/" and all is well now. > > > > > > -- > > > > **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** > > Bob van der Poel ** Wynndel, British Columbia, CANADA ** > > EMAIL: bob at mellowood.ca > > WWW: http://www.mellowood.ca > > -- > > https://mail.python.org/mailman/listinfo/python-list From hjp-python at hjp.at Sun May 11 05:58:58 2025 From: hjp-python at hjp.at (Peter J. Holzer) Date: Sun, 11 May 2025 11:58:58 +0200 Subject: backslash in triple quoted string In-Reply-To: References: Message-ID: <20250511095858.rwhc7qazptpzntgo@hjp.at> On 2025-05-08 08:05:54 +0200, Left Right via Python-list wrote: > Also, it appears that the change linked above is a lie: Such strong words ... > https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-longstringitem > > According to the grammar, any character can follow backslash in a > valid Python program. The warning / error raised by this code should > not be a syntax error / warning because the syntax is correct. Warnings are about technically correct but probably unintended usage. The documentation you linked to describes (a bit further down) which escape sequences are recognized and what happens if you use an unrecognized escape sequence. It also mentions that using an unrecognized escape sequence *will* be an error in future versions of Python. A warning is appropriate here. It gives the programmer a chance to fix the program now before it breaks. One could argue that it should say 'unrecognized escape sequence' instead of 'invalid escape sequence', since it isn't invalid yet, but that's nitpicking. hjp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp at hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From olegsivokon at gmail.com Sun May 11 06:36:31 2025 From: olegsivokon at gmail.com (Left Right) Date: Sun, 11 May 2025 12:36:31 +0200 Subject: backslash in triple quoted string In-Reply-To: <20250511095858.rwhc7qazptpzntgo@hjp.at> References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: Then it just means that the grammar lies. The two claims are mutually exclusive, so either one is a lie or the other or both. My comment was more of an irony really. It's plenty obvious that the grammar is a lie. The reason is that it's tedious to put the actual intender rules into the grammar, and so whoever wrote the grammar decided to cut corners. But, the grammar is supposed to be the authoritative source for how the language is parsed, that's why even though it's clear that the grammar is a lie, blaming whoever doesn't follow it makes it ironic. In other words, the grammar author didn't put enough effort into making grammar actually work, but seeing how many other things are done in Python, this is not an exception. It would've been strange to have it done properly when "properly" means doing copious amounts of tedious work. On Sun, May 11, 2025 at 12:11?PM Peter J. Holzer via Python-list wrote: > > On 2025-05-08 08:05:54 +0200, Left Right via Python-list wrote: > > Also, it appears that the change linked above is a lie: > > Such strong words ... > > > > https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-longstringitem > > > > According to the grammar, any character can follow backslash in a > > valid Python program. The warning / error raised by this code should > > not be a syntax error / warning because the syntax is correct. > > Warnings are about technically correct but probably unintended usage. > > The documentation you linked to describes (a bit further down) which > escape sequences are recognized and what happens if you use an > unrecognized escape sequence. It also mentions that using an > unrecognized escape sequence *will* be an error in future versions of > Python. > > A warning is appropriate here. It gives the programmer a chance to fix > the program now before it breaks. > > One could argue that it should say 'unrecognized escape sequence' > instead of 'invalid escape sequence', since it isn't invalid yet, but > that's nitpicking. > > hjp > > -- > _ | Peter J. Holzer | Story must make more sense than reality. > |_|_) | | > | | | hjp at hjp.at | -- Charles Stross, "Creative writing > __/ | http://www.hjp.at/ | challenge!" > -- > https://mail.python.org/mailman/listinfo/python-list From rosuav at gmail.com Sun May 11 06:47:52 2025 From: rosuav at gmail.com (Chris Angelico) Date: Sun, 11 May 2025 20:47:52 +1000 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: On Sun, 11 May 2025 at 20:38, Left Right via Python-list wrote: > > My comment was more of an irony really. It's plenty obvious that the > grammar is a lie. The reason is that it's tedious to put the actual > intender rules into the grammar, and so whoever wrote the grammar > decided to cut corners. But, the grammar is supposed to be the > authoritative source for how the language is parsed, that's why even > though it's clear that the grammar is a lie, blaming whoever doesn't > follow it makes it ironic. Have you ever built a language parser? I'm going to guess you haven't. ChrisA From richard at damon-family.org Sun May 11 07:16:05 2025 From: richard at damon-family.org (Richard Damon) Date: Sun, 11 May 2025 07:16:05 -0400 (EDT) Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: <1474665319.227.1746962165437@email.ionos.com> On 05/11/2025 6:36 AM EDT Left Right via Python-list <[1]python-list at python.org> wrote: Then it just means that the grammar lies. The two claims are mutually exclusive, so either one is a lie or the other or both. No, it more points out that not all errors are grammatical. The grammar does not (and can not) fully define what is a legal program. Some forms of error are semantic, like undefined symbols. It appears that rather than try to make the grammar complicated enough to describe what is a valid string, that operation was moved into the semantics of a string, which simplifies the rules quite a bit. References Visible links 1. mailto:python-list at python.org From hjp-python at hjp.at Sun May 11 11:13:34 2025 From: hjp-python at hjp.at (Peter J. Holzer) Date: Sun, 11 May 2025 17:13:34 +0200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: <20250511151334.offwub4qjff7ukyd@hjp.at> On 2025-05-11 12:36:31 +0200, Left Right via Python-list wrote: > Then it just means that the grammar lies. No, because the parser accepts the sequence. And it produces exactly what the description says. The program #!/usr/bin/python3 print("start") for i in range(3): print("\copy") print("end") is valid and prints start \copy \copy \copy end to stdout, as you would expect from reading the docs. But in addition to that it also prints the *warning* (not error, that's a difference) /home/hjp/tmp/./foo:5: SyntaxWarning: invalid escape sequence '\c' print("\copy") to stderr (this is also documented). One can quibble over the exact wording of the warning ("unrecognized" would be more in line with the documentation than "invalid"), but there are reasons for the warning. > The two claims are mutually exclusive, so either one is a lie or the > other or both. No they are not. The grammar says that the program will compile and run, which it does. The warning tells you that this probably wasn't a good idea. Warnings about stuff that is technically correct aren't unusual. For example, in C something like #v+ int a = 5, b = 3; if (a = b) { printf("a = %d\n", a); } #v- is totally legal (and will print "a = 3"). However, most compilers will warn about this because it is very likely that the programmer wanted to write ?if (a == b) ...?. > My comment was more of an irony really. It's plenty obvious that the > grammar is a lie. The reason is that it's tedious to put the actual > intender rules into the grammar, and so whoever wrote the grammar > decided to cut corners. But, the grammar is supposed to be the > authoritative source for how the language is parsed, Which it is. > that's why even though it's clear that the grammar is a lie, blaming > whoever doesn't follow it makes it ironic. > > In other words, the grammar author didn't put enough effort into > making grammar actually work, But the grammar *does* describe how it actually works. You *can* write any character after a backslash, and your programm will compile and run. It is likely that in some future version of Python that will not be the case any more. *Then* the grammar must be changed. Until then the documentation should match the current implementation and not something which may or may not be implemented at some point in the future. > but seeing how many other things are done in Python, this is not an > exception. It would've been strange to have it done properly when > "properly" means doing copious amounts of tedious work. As usual you're making up your lack of knowledge with an abundance of opinion. hjp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp at hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From olegsivokon at gmail.com Sun May 11 11:19:24 2025 From: olegsivokon at gmail.com (Left Right) Date: Sun, 11 May 2025 17:19:24 +0200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: > Have you ever built a language parser? I've lost count by now. Probably fewer than hundred times though. From olegsivokon at gmail.com Sun May 11 11:21:58 2025 From: olegsivokon at gmail.com (Left Right) Date: Sun, 11 May 2025 17:21:58 +0200 Subject: backslash in triple quoted string In-Reply-To: <20250511151334.offwub4qjff7ukyd@hjp.at> References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <20250511151334.offwub4qjff7ukyd@hjp.at> Message-ID: Hahah... what a pile of rubbish. The point is that the error is wrong. It cannot be a syntax error and at the same time the program compiles. You need to choose one. But, sure, go ahead, foam at the mouth, if it makes you feel better about it. From rosuav at gmail.com Sun May 11 11:24:26 2025 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 12 May 2025 01:24:26 +1000 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: On Mon, 12 May 2025 at 01:19, Left Right wrote: > > > Have you ever built a language parser? > > I've lost count by now. Probably fewer than hundred times though. Show me then. Prove it. You're all hot air and opinions and bluster. Show some actual code, and show that you can do right what you're complaining that Python has done wrong. I'm not holding my breath. ChrisA From rosuav at gmail.com Sun May 11 11:28:16 2025 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 12 May 2025 01:28:16 +1000 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <20250511151334.offwub4qjff7ukyd@hjp.at> Message-ID: On Mon, 12 May 2025 at 01:24, Left Right via Python-list wrote: > > But, sure, go ahead, foam at the mouth, if it > makes you feel better about it. Projecting, much? ChrisA From olegsivokon at gmail.com Sun May 11 13:17:29 2025 From: olegsivokon at gmail.com (Left Right) Date: Sun, 11 May 2025 19:17:29 +0200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <20250511151334.offwub4qjff7ukyd@hjp.at> Message-ID: Oh, so this is where 4chan relocated after they were hacked? What a refined discussion! On Sun, May 11, 2025 at 5:28?PM Chris Angelico wrote: > > On Mon, 12 May 2025 at 01:24, Left Right via Python-list > wrote: > > > > But, sure, go ahead, foam at the mouth, if it > > makes you feel better about it. > > Projecting, much? > > ChrisA From olegsivokon at gmail.com Sun May 11 13:35:28 2025 From: olegsivokon at gmail.com (Left Right) Date: Sun, 11 May 2025 19:35:28 +0200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: https://gitlab.com/doodles-archive/protopy/-/blob/master/protopy/lib/protopy.y?ref_type=heads Here's one. It's not great, not awful. https://gitlab.com/doodles-archive/protopy/-/blob/master/cris-angelico-is-a-moron.org?ref_type=heads Here's a proof that I have commit rights to this repo On Sun, May 11, 2025 at 5:24?PM Chris Angelico wrote: > > On Mon, 12 May 2025 at 01:19, Left Right wrote: > > > > > Have you ever built a language parser? > > > > I've lost count by now. Probably fewer than hundred times though. > > Show me then. Prove it. You're all hot air and opinions and bluster. > Show some actual code, and show that you can do right what you're > complaining that Python has done wrong. > > I'm not holding my breath. > > ChrisA From rosuav at gmail.com Sun May 11 13:38:06 2025 From: rosuav at gmail.com (Chris Angelico) Date: Mon, 12 May 2025 03:38:06 +1000 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: On Mon, 12 May 2025 at 03:35, Left Right wrote: > > https://gitlab.com/doodles-archive/protopy/-/blob/master/cris-angelico-is-a-moron.org?ref_type=heads > Here's a proof that I have commit rights to this repo > I didn't ask for that, and you don't even have the respect to spell my name correctly. You can leave that there, I don't really care. All it really proves is that you have zero respect for anyone else. ChrisA From olegsivokon at gmail.com Sun May 11 13:45:43 2025 From: olegsivokon at gmail.com (Left Right) Date: Sun, 11 May 2025 19:45:43 +0200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: Why of all people would I respect you? What did you ever do other than insult me? :) Now you are acting surprised? On Sun, May 11, 2025 at 7:38?PM Chris Angelico wrote: > > On Mon, 12 May 2025 at 03:35, Left Right wrote: > > > > https://gitlab.com/doodles-archive/protopy/-/blob/master/cris-angelico-is-a-moron.org?ref_type=heads > > Here's a proof that I have commit rights to this repo > > > > I didn't ask for that, and you don't even have the respect to spell my > name correctly. > > You can leave that there, I don't really care. All it really proves is > that you have zero respect for anyone else. > > ChrisA From greg.ewing at canterbury.ac.nz Sun May 11 22:32:29 2025 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 12 May 2025 14:32:29 +1200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <20250511151334.offwub4qjff7ukyd@hjp.at> Message-ID: On 12/05/25 3:21 am, Left Right wrote: > The point is that the error is wrong. > It cannot be a syntax error and at the same time the program compiles. But the message doesn't say it's an error. It uses the word "warning", not "error". You're tilting at a straw horse here. -- Greg From larry.martell at gmail.com Mon May 12 10:03:30 2025 From: larry.martell at gmail.com (Larry Martell) Date: Mon, 12 May 2025 07:03:30 -0700 Subject: PyCon Message-ID: Anyone going to PyCon? I'll be there, getting in Tuesday night. From Keith.S.Thompson+u at gmail.com Sun May 11 18:02:37 2025 From: Keith.S.Thompson+u at gmail.com (Keith Thompson) Date: Sun, 11 May 2025 15:02:37 -0700 Subject: backslash in triple quoted string References: <20250511095858.rwhc7qazptpzntgo@hjp.at> Message-ID: <87msbikdqa.fsf@nosuchdomain.example.com> Left Right writes: > Then it just means that the grammar lies. The two claims are mutually > exclusive, so either one is a lie or the other or both. [...] A couple of points. First, the convention in this and most other Usenet newsgroups is to write new text *below* any quoted text. This is known as "bottom-posting". The alternative, "top-posting" is common in email in some environments, but tends to cause confusion on Usenet. It's also a good idea to trim any quoted text that's not relevant to your followup. See most of the other followups in this newsgroup, including this one, for examples. Even if you happen to prefer top-posting, I suggest trying to follow the existing conventions observed by the vast majority of participants here. Second, the word "lie" is far more harsh than what I presume you meant to say. For me, and I think for most people, the word "lie" implies a deliberate intent to deceive. I don't think you actually believe that the authors of the documentation you're complaining about deliberately inserted false information with the goal of deceiving readers. If you want to say that the grammar is incorrect, or contains an error, that's something that can be discussed reasonably. If you say that it "lies", you're making a claim of malice and making assumptions about someone else's state of mind with no real basis. Perhaps that's not what the word "lie" means to you, but I suggest that it explains the harsh reaction to your initial statement. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u at gmail.com void Void(void) { Void(); } /* The recursive call of the void */ From olegsivokon at gmail.com Mon May 12 14:28:00 2025 From: olegsivokon at gmail.com (Left Right) Date: Mon, 12 May 2025 20:28:00 +0200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <20250511151334.offwub4qjff7ukyd@hjp.at> Message-ID: > But the message doesn't say it's an error. It uses the word "warning", > not "error". You're tilting at a straw horse here. Read the associate release note. From olegsivokon at gmail.com Mon May 12 14:42:17 2025 From: olegsivokon at gmail.com (Left Right) Date: Mon, 12 May 2025 20:42:17 +0200 Subject: backslash in triple quoted string In-Reply-To: <87msbikdqa.fsf@nosuchdomain.example.com> References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <87msbikdqa.fsf@nosuchdomain.example.com> Message-ID: > Second, the word "lie" is far more harsh than what I presume > you meant to say. For me, and I think for most people, the word > "lie" implies a deliberate intent to deceive. No, it doesn't. Consider Joseph Conrand's Heart of Darkness, the final episode where Marlow comes to Kurtz' widow and tells her about how her husband died. He lies to her, but his intent is not to deceive her, instead, he intends to make sure that her delusion of her late husband is unharmed and that she continues to live that delusion because he judges she will be better off for it. In fact, you yourself used the word deceit, which is to lie with intention to benefit from a lie. But people tell lies for all sorts of reasons. People can lie by omission, through embellishment, by choosing to focus on less relevant aspects of the event. All of these are lies. When a painter mixes white paint into the form shadow of a plaster ball, she lies. When Google Maps puts the destination marker of the restaurant you have a reservation in in the middle of a sea, it lies. English literature lessons aside, even if you believe what you believe about the meaning of the word, you could at least try to find the irony, that was the larger goal, than to immediately presume you are being attacked, and start retaliating instead of looking into the problem. From ethan at stoneleaf.us Mon May 12 13:58:27 2025 From: ethan at stoneleaf.us (Ethan Furman) Date: Mon, 12 May 2025 10:58:27 -0700 Subject: backslash in triple quoted string In-Reply-To: References: Message-ID: <55586fae-18c9-4330-a681-db11d0ea183b@stoneleaf.us> Chris and Oleg (sp?), please control your tempers; your latter posts added nothing useful to the conversation. (Apologies for the late reply, I was out of town.) -- ~Ethan~ Moderator From Keith.S.Thompson+u at gmail.com Mon May 12 16:55:12 2025 From: Keith.S.Thompson+u at gmail.com (Keith Thompson) Date: Mon, 12 May 2025 13:55:12 -0700 Subject: backslash in triple quoted string References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <87msbikdqa.fsf@nosuchdomain.example.com> Message-ID: <87y0v11rdb.fsf@nosuchdomain.example.com> Left Right writes: >> Second, the word "lie" is far more harsh than what I presume >> you meant to say. For me, and I think for most people, the word >> "lie" implies a deliberate intent to deceive. > > No, it doesn't. Consider Joseph Conrand's Heart of Darkness, No, thank you. I am trying to help you to understand how people are reacting to your posts. I suggested that saying that the grammar is incorrect or contains an error would have expressed exactly what you intended without triggering hostile reactions, which I'm assuming you don't want. [...] > English literature lessons aside, even if you believe what you believe > about the meaning of the word, you could at least try to find the > irony, that was the larger goal, than to immediately presume you are > being attacked, and start retaliating instead of looking into the > problem. I'm not aware that I have been attacked or that I have retaliated. (No need to explain why you might think I have.) One more thing: your Usenet or email client probably adds an attribution line above any quoted text. I urge you to leave it in place. It makes the discussion easier to follow, especially for those of us who read the comp.lang.python Usenet newsgroup rather than the mailing list. I do not intend to reply further. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u at gmail.com void Void(void) { Void(); } /* The recursive call of the void */ From greg.ewing at canterbury.ac.nz Mon May 12 20:11:13 2025 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 13 May 2025 12:11:13 +1200 Subject: backslash in triple quoted string In-Reply-To: References: <20250511095858.rwhc7qazptpzntgo@hjp.at> <20250511151334.offwub4qjff7ukyd@hjp.at> Message-ID: On 13/05/25 6:28 am, Left Right wrote: > Read the associate release note. I take it you're referring to this: > In a future Python version, SyntaxError will > eventually be raised, instead of SyntaxWarning. (Contributed by Victor > Stinner in gh-98401.) That doesn't contradict what I said. Currently it's a warning. If and when it becomes an error, presumably the grammar documentation will be updated to reflect that. If it isn't, you'll have cause to complain, but not before. -- Greg From list1 at tompassin.net Tue May 13 09:34:39 2025 From: list1 at tompassin.net (Thomas Passin) Date: Tue, 13 May 2025 09:34:39 -0400 Subject: backslash in triple quoted string In-Reply-To: References: Message-ID: <08f8c6cc-1cb0-4bb1-860f-d9cd56f6a4af@tompassin.net> On 5/8/2025 2:05 AM, Left Right via Python-list wrote: > Also, it appears that the change linked above is a lie: > > https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-longstringitem > > According to the grammar, any character can follow backslash in a > valid Python program. The warning / error raised by this code should > not be a syntax error / warning because the syntax is correct. "Changed in version 3.12: Unrecognized escape sequences produce a SyntaxWarning. In a future Python version they will be eventually a SyntaxError." See https://docs.python.org/3/reference/lexical_analysis.html#strings Test case for "\" in triple-quoted string: [code] >>> def f(): ... """\hello""" :2: SyntaxWarning: invalid escape sequence '\h' ... print('hi') ... >>> f() hi [/code] This example fits the documentation exactly. A SyntaxWarning is emitted for the unrecognized escape sequence "\h". The program runs as intended. Please let's drop all the OT back-and-forth. > On Thu, May 8, 2025 at 7:54?AM Left Right wrote: >> >> I think it could be this: >> >> A backslash-character pair that is not a valid escape sequence now >> generates a SyntaxWarning, instead of DeprecationWarning. For example, >> re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid >> escape sequence, use raw strings for regular expression: >> re.compile(r"\d+\.\d+")). In a future Python version, SyntaxError will >> eventually be raised, instead of SyntaxWarning. (Contributed by Victor >> Stinner in gh-98401.) >> >> Found in: >> https://docs.python.org/3/whatsnew/3.12.html#other-language-changes >> >> It's not supposed to crash your program though. If the program crashes >> because of it, it's a bug in Python. >> >> On Thu, May 8, 2025 at 7:00?AM Bob van der Poel via Python-list >> wrote: >>> >>> Did something change in python buggering up my use of a "\ " sequence in a >>> triple quoted string? >>> >>> I have yet to go through my archive on the program, but I tried to run it >>> today and it crashed quite spectacularly when it hit a """ .... """ line >>> being used as a comment at the top of a function. I changed the "\" to a >>> "/" and all is well now. >>> >>> >>> -- >>> >>> **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** >>> Bob van der Poel ** Wynndel, British Columbia, CANADA ** >>> EMAIL: bob at mellowood.ca >>> WWW: http://www.mellowood.ca >>> -- >>> https://mail.python.org/mailman/listinfo/python-list From info at egenix.com Wed May 14 07:42:22 2025 From: info at egenix.com (eGenix Team) Date: Wed, 14 May 2025 13:42:22 +0200 Subject: ANN: eGenix Antispam Bot for Telegram 0.7.1 Message-ID: *ANNOUNCING* eGenix Antispam Bot for Telegram Version 0.7.1 A simple, yet effective bot implementation to address Telegram signup spam. This announcement is also available on our web-site for online reading: https://www.egenix.com/company/news/eGenix-Antispam-Bot-for-Telegram-0.7.1-GA.html ------------------------------------------------------------------------ *INTRODUCTION* eGenix has long been running a local Python user group meeting in D?sseldorf called /Python Meeting D?sseldorf / and we are using a Telegram group for most of our communication. In the early days, the group worked well and we only had few spammers joining it, which we could well handle manually. More recently, this has changed dramatically. We are seeing between 2-5 spam signups per day, often at night. Furthermore, the signups accounts are not always easy to spot as spammers, since they often come with profile images, descriptions, etc. With the bot, we now have a more flexible way of dealing with the problem. Please see our project page for details and download links: https://www.egenix.com/library/telegram-antispam-bot/ ------------------------------------------------------------------------ *FEATURES* * Low impact mode of operation: the bot tries to keep noise in the group to a minimum * Several challenge mechanisms to choose from, more can be added as needed * Flexible and easy to use configuration * Only needs a few MB of RAM, so can easily be put into a container or run on a Raspberry Pi * Can handle quite a bit of load due to the async implementation * Works with Python 3.9+ * MIT open source licensed ------------------------------------------------------------------------ *NEWS* The 0.7.1 release fixes a few bugs and adds more features: * Added missing dependency on emoji package to setup (bug introduced in 0.7.0, fixed in 0.7.1) * Added user name check for number of emojis, since these are being used a lot by spammers * Added wheel as requirement, since this is no longer included per default * Updated copyright year It has been battle-tested in production for?several years already already and is proving to be a really useful tool to help with Telegram group administration. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, May 14 2025) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ From sch at fedora.email Wed May 14 11:59:35 2025 From: sch at fedora.email (Schimon Jehudah) Date: Wed, 14 May 2025 18:59:35 +0300 Subject: ANN: eGenix Antispam Bot for Telegram 0.7.1 In-Reply-To: References: Message-ID: <20250514185935.71b5571d@workstation.localdomain> Good evening. Is this service also available for XMPP? I am working on a similar project which is called KaikOut, and I will be glad to collaborate. https://git.xmpp-it.net/sch/KaikOut Moderation service for XMPP Currently, it supports XMPP, and in future it would also support IRC. Kind regards, Schimon On Wed, 14 May 2025 13:42:22 +0200 eGenix Team via Python-list wrote: > *ANNOUNCING* > > > eGenix Antispam Bot for Telegram > > Version 0.7.1 > > A simple, yet effective bot implementation > to address Telegram signup spam. > > This announcement is also available on our web-site for online > reading: > https://www.egenix.com/company/news/eGenix-Antispam-Bot-for-Telegram-0.7.1-GA.html > > ------------------------------------------------------------------------ > *INTRODUCTION* > > eGenix has long been running a local Python > user group meeting in D?sseldorf called /Python Meeting D?sseldorf > / and we are using a Telegram group for most of > our communication. > > In the early days, the group worked well and we only had few spammers > joining it, which we could well handle manually. > > More recently, this has changed dramatically. We are seeing between > 2-5 spam signups per day, often at night. Furthermore, the signups > accounts are not always easy to spot as spammers, since they often > come with profile images, descriptions, etc. > > With the bot, we now have a more flexible way of dealing with the > problem. > > Please see our project page for details and download links: > > https://www.egenix.com/library/telegram-antispam-bot/ > > ------------------------------------------------------------------------ > *FEATURES* > > * Low impact mode of operation: the bot tries to keep noise in the > group to a minimum > * Several challenge mechanisms to choose from, more can be added as > needed > * Flexible and easy to use configuration > * Only needs a few MB of RAM, so can easily be put into a container > or run on a Raspberry Pi > * Can handle quite a bit of load due to the async implementation > * Works with Python 3.9+ > * MIT open source licensed > > > ------------------------------------------------------------------------ > *NEWS* > > The 0.7.1 release fixes a few bugs and adds more features: > > * Added missing dependency on emoji package to setup (bug introduced > in 0.7.0, fixed in 0.7.1) > * Added user name check for number of emojis, since these are being > used a lot by spammers > * Added wheel as requirement, since this is no longer included per > default > * Updated copyright year > > It has been battle-tested in production for?several years already > already and is proving to be a really useful tool to help with > Telegram group administration. > > > Enjoy, > From sch at fedora.email Wed May 14 14:04:53 2025 From: sch at fedora.email (Schimon Jehudah) Date: Wed, 14 May 2025 21:04:53 +0300 Subject: [egenix-info] ANN: eGenix Antispam Bot for Telegram 0.7.1 In-Reply-To: References: <20250514185935.71b5571d@workstation.localdomain> Message-ID: <20250514210453.7ad6c8f2@workstation.localdomain> Marc-Andre. Good evening. Thank you for your respond. I will definitely explore your project. The XMPP modules are atomized in a single directory /interface/xmpp/ in order to make it extendible to other interfaces (i.e. protocols). I do consider to transform the directory of XMPP modules into a framework for building XMPP bots. I sense, that collaboration be feasible. Kind regards, Schimon On Wed, 14 May 2025 19:19:01 +0200 Marc-Andre Lemburg wrote: > Hi Schimon, > > thanks for reaching out. Our bot is TG-only, since we built it for > our user group chat group running on TG. > > But I suppose you can make use of the types of challenges we use for > XMPP and IRC as well. > > The strategies are working quite well for us, even though they are > not perfect. It reduces the admin work substantially, plus it's easy > to extend, so we can always tune them or add new ones. > > Thanks, From laurent.pointal at free.fr Wed May 14 13:49:04 2025 From: laurent.pointal at free.fr (Laurent Pointal) Date: 14 May 2025 17:49:04 GMT Subject: [ANN] New version 2.1.0 of L.Pointal's Python 3 Cheat Sheet Message-ID: <6824d790$0$5210$426a74cc@news.free.fr> Hello, In the context of a move for hosting of my one recto-verso pdf cheat sheet, I updated it to add Python's news stuff and make a new 2.1.0 version (latest version, 2.0.6, was from 2017). DOWNLOAD ======== English version is at https://py3cheatsheet.lisn.fr/ (its a short URL fore real hosting) MODIFICATIONS ============= * Add assignment := (morse) operator * Add match ... case instruction * For strings formating, switch to f-strings * Add str methods .format(), .removeprefix(), .removesuffix() * Revised for loops on index to use enumerate with index, value * Add functionnal programming map and filter list comprehension expressions * Add dict's | merge and |= update operators * Reorganize sequences index sectionto make room * Add with () group of context to open multiple files A+ L.Pointal. From mal at egenix.com Wed May 14 13:19:01 2025 From: mal at egenix.com (Marc-Andre Lemburg) Date: Wed, 14 May 2025 19:19:01 +0200 Subject: [egenix-info] ANN: eGenix Antispam Bot for Telegram 0.7.1 In-Reply-To: <20250514185935.71b5571d@workstation.localdomain> References: <20250514185935.71b5571d@workstation.localdomain> Message-ID: Hi Schimon, thanks for reaching out. Our bot is TG-only, since we built it for our user group chat group running on TG. But I suppose you can make use of the types of challenges we use for XMPP and IRC as well. The strategies are working quite well for us, even though they are not perfect. It reduces the admin work substantially, plus it's easy to extend, so we can always tune them or add new ones. Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, May 14 2025) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ On 14.05.2025 17:59, Schimon Jehudah wrote: > Good evening. > > Is this service also available for XMPP? > > I am working on a similar project which is called KaikOut, and I will > be glad to collaborate. > > https://git.xmpp-it.net/sch/KaikOut > Moderation service for XMPP > > Currently, it supports XMPP, and in future it would also support IRC. > > Kind regards, > Schimon > > > On Wed, 14 May 2025 13:42:22 +0200 > eGenix Team via Python-list wrote: > >> *ANNOUNCING* >> >> >> eGenix Antispam Bot for Telegram >> >> Version 0.7.1 >> >> A simple, yet effective bot implementation >> to address Telegram signup spam. >> >> This announcement is also available on our web-site for online >> reading: >> https://www.egenix.com/company/news/eGenix-Antispam-Bot-for-Telegram-0.7.1-GA.html >> >> ------------------------------------------------------------------------ >> *INTRODUCTION* >> >> eGenix has long been running a local Python >> user group meeting in D?sseldorf called /Python Meeting D?sseldorf >> / and we are using a Telegram group for most of >> our communication. >> >> In the early days, the group worked well and we only had few spammers >> joining it, which we could well handle manually. >> >> More recently, this has changed dramatically. We are seeing between >> 2-5 spam signups per day, often at night. Furthermore, the signups >> accounts are not always easy to spot as spammers, since they often >> come with profile images, descriptions, etc. >> >> With the bot, we now have a more flexible way of dealing with the >> problem. >> >> Please see our project page for details and download links: >> >> https://www.egenix.com/library/telegram-antispam-bot/ >> >> ------------------------------------------------------------------------ >> *FEATURES* >> >> * Low impact mode of operation: the bot tries to keep noise in the >> group to a minimum >> * Several challenge mechanisms to choose from, more can be added as >> needed >> * Flexible and easy to use configuration >> * Only needs a few MB of RAM, so can easily be put into a container >> or run on a Raspberry Pi >> * Can handle quite a bit of load due to the async implementation >> * Works with Python 3.9+ >> * MIT open source licensed >> >> >> ------------------------------------------------------------------------ >> *NEWS* >> >> The 0.7.1 release fixes a few bugs and adds more features: >> >> * Added missing dependency on emoji package to setup (bug introduced >> in 0.7.0, fixed in 0.7.1) >> * Added user name check for number of emojis, since these are being >> used a lot by spammers >> * Added wheel as requirement, since this is no longer included per >> default >> * Updated copyright year >> >> It has been battle-tested in production for?several years already >> already and is proving to be a really useful tool to help with >> Telegram group administration. >> >> >> Enjoy, >> From lhpitn at outlook.de Fri May 16 22:45:39 2025 From: lhpitn at outlook.de (T N) Date: Sat, 17 May 2025 02:45:39 +0000 Subject: IDLE: dark mode on windows? Message-ID: <610e8778b6f34c9b9e3531cc72957049DU0P251MB0409301763BA01A6B55FC375BB92A@DU0P251MB0409.EURP251.PROD.OUTLOOK.COM> Hi there, i hope you can help me and this is the right address, i tried mailing idle-dev at python.org but it bounced, please forward if possible, ive got IDLE 3.7.9 on windows 10, and windows 10 is set to dark mode, but all windows by IDLE are bright as a painful light, is there any way to make it all like dark mode? i managed to switch the console/edit area to dark mode using the attatched hack, but that looks even worse cause now title, menu/scroll and status bar are bright and only the center edit is dark, a bit better then before but not as nice as i want. I know from expirences using tk based software under linux that it is possible to get something like dark mode, i dont know how exactly i did it but i guess it was not that hard, probably some color changes in the desktop enviorment that not only changed gtk's and qt's behavior but also tk's or some other stuff like that thing that makes xterm switch to dark mode... But under windows i would like that it , in an ideal case, just acts based on the global setting introduced since windows 10, maybe implement that in coming versions... Or is there any other way to hack this by putting some tk config files somewhere. i would aprichiate any help on that. thanks a lot in advance, Tim from Hamburg From lhpitn at outlook.de Fri May 16 22:46:47 2025 From: lhpitn at outlook.de (T N) Date: Sat, 17 May 2025 02:46:47 +0000 Subject: WG: dont use C:\Windows as working directory when installed using microsoft store In-Reply-To: References: Message-ID: ________________________________________ Von: T N Gesendet: Samstag, 17. Mai 2025 04:33 An: idle-dev at python.org Betreff: dont use C:\Windows as working directory when installed using microsoft store Hi, ive installed python with IDLE using the microsoft store, but one big issue with it: whenever i try to save a new file it prompts me to put it in C:\Windows\ which is not a good idea, %userprofile% or %userprofile%\Documents\ would be more appropriate. Normally i just change the value of "start in" on the .lnk in the start menu but in case of an app this is not possible so please fix that Thanks a lot in advance and keep up the good work TN From miked at dewhirst.com.au Sun May 18 10:39:02 2025 From: miked at dewhirst.com.au (Mike Dewhirst) Date: Mon, 19 May 2025 00:39:02 +1000 Subject: =?US-ASCII?Q?RE:_WG:_dont_use_C:\Windows_as_working_dir?= =?US-ASCII?Q?ectory_when_installed_using=0D__microsoft_store?= In-Reply-To: Message-ID: <4b0kFS5lPpznWG8@mail.python.org> Apologies for top-posting. It's my phone's fault.Since? no-one appears to have responded, I'll stir up some aggro and offer my opinion based on ~45 years experience with Microsoft.Uninstall python/idle etc completely and download from python.org instead. I would advise ignoring recommendations and install to c:/python313 or whatever version suits.?From then, I would establish a virtual environment for each project and ignore Windows paths.?The clever things built into Windows specific kit have built-in assumptions which probably suit some people but not you. Nor me.Good luck.Mike?--Unsigned mail from my phone -------- Original message --------From: T N via Python-list Date: 17/5/25 12:54 (GMT+10:00) To: python-list at python.org Subject: WG: dont use C:\Windows as working directory when installed using microsoft store ________________________________________Von: T NGesendet: Samstag, 17. Mai 2025 04:33An: idle-dev at python.orgBetreff: dont use C:\Windows as working directory when installed using microsoft storeHi,ive installed python with IDLE using the microsoft store, but one big issue with it:whenever i try to save a new file it prompts me to put it in C:\Windows\ which is not a good idea, %userprofile% or %userprofile%\Documents\ would be more appropriate. Normally i just change the value of "start in" on the .lnk in the start menu but in case of an app this is not possibleso please fix thatThanks a lot in advance and keep up the good workTN-- https://mail.python.org/mailman/listinfo/python-list From larry.martell at gmail.com Sun May 18 16:16:41 2025 From: larry.martell at gmail.com (Larry Martell) Date: Sun, 18 May 2025 16:16:41 -0400 Subject: Trailer for upcoming Python documentary Message-ID: https://youtu.be/pqBqdNIPrbo?si=P2ukSXnDj3qy3HBJ From mats at wichmann.us Sun May 18 19:22:03 2025 From: mats at wichmann.us (Mats Wichmann) Date: Sun, 18 May 2025 17:22:03 -0600 Subject: WG: dont use C:\Windows as working directory when installed using microsoft store In-Reply-To: <4b0kFS5lPpznWG8@mail.python.org> References: <4b0kFS5lPpznWG8@mail.python.org> Message-ID: On 5/18/25 08:39, Mike Dewhirst via Python-list wrote: > Apologies for top-posting. It's my phone's fault.Since? no-one appears to have responded, I'll stir up some aggro and offer my opinion based on ~45 years experience with Microsoft.Uninstall python/idle etc completely and download from python.org instead. I would advise ignoring recommendations and install to c:/python313 or whatever version suits.?From then, I would establish a virtual environment for each project and ignore Windows paths.?The clever things built into Windows specific kit have built-in assumptions which probably suit some people but not you. Nor me.Good luck.Mike?--Unsigned mail from my phone I did respond and something went wrong with the copy that was supposed to go to the list, still need to investigate why. IDLE uses the directory it was started in. That's absolutely fine if you're in a directory you want to work in, and you type "idle" to a command-line shell. If you launch IDLE, like any command, by clicking on an icon, the start directory depends on how desktop-style launching works (it doesn't have the context of a "current working directory" that you have in a shell), and on configuration settings. Without configuration (whether by the user explicitly, or by the way the launch icon is set up during program installation), it's likely to be the location of the icon file, or some other uninteresting place. It's not just Windows where problems have happened with IDLE using current-directory that's not what folks expect - you can find grumbles for Mac as well if you look on the Internet. Configuring the launch directory for a command run via an icon is very system-specific. On Windows you can configure the properties of the icon (the real one, not the one in the launch menu, which is a shortcut)... except, as in the OP's case, if you used the Store version, which is an "app", where you apparently can't. Store apps have some special restrictions, which, in my possibly slightly less radical opinion, means the Python one is not really worth using. So: - start IDLE from a shell prompt (change directory first if you want a special dev dir) - use the python.org version and configure the launch dir via the icon - use one of the many good editors/IDEs that handle all this stuff. yes that's not a "battery includes" thing like IDLE is, but hey... there are many of these, free, proprietary, or in between. A pair of community-curated lists are at: https://wiki.python.org/moin/IntegratedDevelopmentEnvironments https://wiki.python.org/moin/PythonEditors and there are also a several-digit number of internet sites that promise "the Best Python Editors" and that kind of click-baity thing... From info at tundraware.com Sun May 18 19:15:56 2025 From: info at tundraware.com (Tim Daneliuk) Date: Sun, 18 May 2025 18:15:56 -0500 Subject: Trailer for upcoming Python documentary In-Reply-To: References: Message-ID: On 5/18/25 15:16, Larry Martell wrote: > https://youtu.be/pqBqdNIPrbo?si=P2ukSXnDj3qy3HBJ Get ready Guido: "I'd like to thank the Academy ..." From c.buhtz at posteo.jp Mon May 19 03:22:16 2025 From: c.buhtz at posteo.jp (c.buhtz at posteo.jp) Date: Mon, 19 May 2025 07:22:16 +0000 Subject: Trailer for upcoming Python documentary In-Reply-To: References: Message-ID: <0b90656a51b51e0704033a2b4d846039@posteo.de> Am 18.05.2025 22:16 schrieb Larry Martell via Python-list: > https://youtu.be/pqBqdNIPrbo?si=P2ukSXnDj3qy3HBJ Awesome! Which release channels will be used? How can we pay? From jgossage at gmail.com Mon May 19 11:51:53 2025 From: jgossage at gmail.com (Jonathan Gossage) Date: Mon, 19 May 2025 11:51:53 -0400 Subject: Dynamic classes Message-ID: I have created a dynamic class using the type() function: x = type('MyFlags', (), {'Flag1': 1, 'Flag2': 2, 'Flag3: 4, ' '__init__' : __init__}) The new class is there, and the class variables, Flag1, Flag2, and Flag3, are present correctly. However, when I try to create an instance of this class with the following code: y = x('Flag1', 'Flag2') it fails with a TypeError stating that 'MyFlags' does not accept arguments. What do I have to do to make this happen?. BTW __init__(self, *args) is defined as the instance initializer. -- Jonathan Gossage From mats at wichmann.us Mon May 19 17:49:53 2025 From: mats at wichmann.us (Mats Wichmann) Date: Mon, 19 May 2025 15:49:53 -0600 Subject: Dynamic classes In-Reply-To: References: Message-ID: <385fb601-4061-4785-809a-94ee1e6c4e11@wichmann.us> On 5/19/25 09:51, Jonathan Gossage via Python-list wrote: > I have created a dynamic class using the type() function: > x = type('MyFlags', (), {'Flag1': 1, 'Flag2': 2, 'Flag3: 4, ' '__init__' : > __init__}) > The new class is there, and the class variables, Flag1, Flag2, and Flag3, > are present correctly. However, when I try to create an instance of this > class with the following code: > y = x('Flag1', 'Flag2') > it fails with a TypeError stating that 'MyFlags' does not accept arguments. > What do I have to do to make this happen?. BTW __init__(self, *args) is > defined as the instance initializer. Might help if you show the init function. I've done something similar to this without trouble, but not using the unpacking (i.e. *args). I used this in an ancient blog post (thus, pre-typing, and such): def transact(acct, amount): acct.balance += amount def pay_interest(acct): acct.balance += acct.balance * acct.interest_rate def account_init(acct, num, name, bal, rate): acct.acct_number = num acct.acct_holder = name acct.balance = bal acct.interest_rate = rate account = { "acct_number": "XXX", "acct_holder": "", "balance": 0.0, "interest_rate": 0.0, "transact": transact, "pay_interest": pay_interest, "__init__": account_init, } AccountType = type("AccountType", (), account) myaccount = AccountType("1234567", "J. Q. Public", 20.0, 0.01) print(myaccount.balance) myaccount.transact(-10) print(myaccount.balance) myaccount.pay_interest() print(myaccount.balance) From list1 at tompassin.net Mon May 19 18:11:20 2025 From: list1 at tompassin.net (Thomas Passin) Date: Mon, 19 May 2025 18:11:20 -0400 Subject: Dynamic classes In-Reply-To: <385fb601-4061-4785-809a-94ee1e6c4e11@wichmann.us> References: <385fb601-4061-4785-809a-94ee1e6c4e11@wichmann.us> Message-ID: <1139f617-1f4e-4ccc-bbfe-bd8bf0ef02e3@tompassin.net> On 5/19/2025 5:49 PM, Mats Wichmann via Python-list wrote: > On 5/19/25 09:51, Jonathan Gossage via Python-list wrote: >> I have created a dynamic class using the type() function: >> x = type('MyFlags', (), {'Flag1': 1, 'Flag2': 2, 'Flag3: 4, ' >> '__init__' : >> __init__}) >> The new class is there, and the class variables, Flag1, Flag2, and Flag3, >> are present correctly. However, when I try to create an instance of this >> class with the following code: >> y = x('Flag1', 'Flag2') >> it fails with a TypeError stating that 'MyFlags' does not accept >> arguments. >> What do I have to do to make this happen?. BTW __init__(self, *args) is >> defined as the instance initializer. > > Might help if you show the init function. I've done something similar to > this without trouble, but not using the unpacking (i.e. *args). I used > this in an ancient blog post (thus, pre-typing, and such): > > def transact(acct, amount): > ??? acct.balance += amount > > def pay_interest(acct): > ??? acct.balance += acct.balance * acct.interest_rate > > def account_init(acct, num, name, bal, rate): > ??? acct.acct_number = num > ??? acct.acct_holder = name > ??? acct.balance = bal > ??? acct.interest_rate = rate > > account = { > ??? "acct_number": "XXX", > ??? "acct_holder": "", > ??? "balance": 0.0, > ??? "interest_rate": 0.0, > ??? "transact": transact, > ??? "pay_interest": pay_interest, > ??? "__init__": account_init, > } > > AccountType = type("AccountType", (), account) > > myaccount = AccountType("1234567", "J. Q. Public", 20.0, 0.01) > print(myaccount.balance) > myaccount.transact(-10) > print(myaccount.balance) > myaccount.pay_interest() > print(myaccount.balance) > It's interesting that in Jython there is a way to do something conceptually similar to turn a Jython class into a Java class. Here's one of mine: synchronized CoordinatorType getCoord() { JythonObjectFactory factory = new JythonObjectFactory ( // Type class, Jython module name, class name CoordinatorType.class, "Coordinator", "Coordinator"); // Java class CoordinatorType coord = (CoordinatorType) factory.createObject(); return coord; } // Instantiate a Coordinator // Error handling elided for clarity CoordinatorType c; c = getCoord(); From rob.cliffe at btinternet.com Mon May 19 18:29:56 2025 From: rob.cliffe at btinternet.com (Rob Cliffe) Date: Mon, 19 May 2025 23:29:56 +0100 Subject: Dynamic classes In-Reply-To: <1139f617-1f4e-4ccc-bbfe-bd8bf0ef02e3@tompassin.net> References: <385fb601-4061-4785-809a-94ee1e6c4e11@wichmann.us> <1139f617-1f4e-4ccc-bbfe-bd8bf0ef02e3@tompassin.net> Message-ID: <229045eb-9273-47b5-b265-298ce67edff3@btinternet.com> On 19/05/2025 23:11, Thomas Passin via Python-list wrote: > On 5/19/2025 5:49 PM, Mats Wichmann via Python-list wrote: >> On 5/19/25 09:51, Jonathan Gossage via Python-list wrote: >>> I have created a dynamic class using the type() function: >>> x = type('MyFlags', (), {'Flag1': 1, 'Flag2': 2, 'Flag3: 4, ' >>> '__init__' : >>> __init__}) This is not my area of expertise, but there is a misplaced quote before ??? '__init__' that should be after ??? 'Flags3 Correct this, and your example runs without error. Best wishes Rob Cliffe From greg.ewing at canterbury.ac.nz Mon May 19 20:29:09 2025 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 20 May 2025 12:29:09 +1200 Subject: Dynamic classes In-Reply-To: References: Message-ID: On 20/05/25 4:33 am, Stefan Ram wrote: > So, the reason you're getting that > TypeError is your __init__ function isn't actually hooked up > right when you build your class with "type". You got to set up > your init before you call "type", and then drop it into the > class dictionary as a /function/ (not as a string). That's what he did, or at least that's what he tried to do. It turns out the misplaced quote was the entire problem -- by a fluke, it didn't result in a syntax error, and ended up putting the __init__ function into the dict under the name 'Flag3: 4, __init__'. -- Greg From olegsivokon at gmail.com Tue May 20 02:03:29 2025 From: olegsivokon at gmail.com (Left Right) Date: Tue, 20 May 2025 08:03:29 +0200 Subject: Dynamic classes In-Reply-To: References: Message-ID: > I have created a dynamic class using the type() function: > x = type('MyFlags', (), {'Flag1': 1, 'Flag2': 2, 'Flag3: 4, ' '__init__' : > __init__}) I find that it's generally more convenient to do this using similar code: def constructor(flag1, flag2): class _Hidden: def __init__(self): self.flag1 = flag1 self.flag2 = flag2 return _Hidden() h = constructor('Flag1', 'Flag2') This accomplishes the same goal (with some overhead, perhaps), but is easier to format, the editor will recognize that you are writing a class rather than a bunch of data bits, you will have the ability to define the methods together with the class, benefit from the class initialization environment (eg. by using @static or @property decorators etc.). Also, this allows class parametrization in ways that are difficult to accomplish using metaclasses and other complicated mechanisms Python language provides to that end. Eg. you can conditionally inherit from different superclasses (so, you can use this approach as a factory that creates different classes), or you can conditionally add methods, conditionally provide different method bodies, conditionally provide different arguments to parametrized decorators.