[Python-Dev] Re: Possible bug in `re` module in Python 3.11?

2022-10-26 Thread MRAB
On 2022-10-26 09:17, Piotr Waszkiewicz wrote: Hi, I would like to ask your guidance as I'm entirely sure whether the problem I'm experiencing should be posted in CPython's repo as a bug issue. I've tried using newly released Python 3.11 interpreter in some of my projects and one of them failed

[Python-Dev] Re: Adding new escapes to regex module

2022-08-17 Thread MRAB
On 2022-08-17 17:34, MRAB wrote: On 2022-08-17 08:25, Serhiy Storchaka wrote: 16.08.22 23:24, MRAB пише: Other regex implementations have escape sequences for horizontal whitespace (`\h` and `\H`) and vertical whitespace (`\v` and `\V`). The regex module already supports `\h`, but I can't

[Python-Dev] Re: Adding new escapes to regex module

2022-08-17 Thread MRAB
On 2022-08-17 08:25, Serhiy Storchaka wrote: 16.08.22 23:24, MRAB пише: Other regex implementations have escape sequences for horizontal whitespace (`\h` and `\H`) and vertical whitespace (`\v` and `\V`). The regex module already supports `\h`, but I can't use `\v` because it represents

[Python-Dev] Re: Adding new escapes to regex module

2022-08-16 Thread MRAB
On 2022-08-16 22:14, Barry Scott wrote: > On 16 Aug 2022, at 21:24, MRAB wrote: > > Other regex implementations have escape sequences for horizontal whitespace (`\h` and `\H`) and vertical whitespace (`\v` and `\V`). > > The regex module already supports `\h`, but I can't u

[Python-Dev] Adding new escapes to regex module

2022-08-16 Thread MRAB
Other regex implementations have escape sequences for horizontal whitespace (`\h` and `\H`) and vertical whitespace (`\v` and `\V`). The regex module already supports `\h`, but I can't use `\v` because it represents `\0x0b', as it does in the re module. Now that someone has asked for it, I'm

[Python-Dev] Re: Switching to Discourse

2022-07-21 Thread MRAB
On 21/07/2022 18:53, Mats Wichmann wrote: On 7/21/22 11:11, Mariatta wrote: On Thu, Jul 21, 2022 at 10:05 AM Skip Montanaro mailto:skip.montan...@gmail.com>> wrote: I have a perhaps stupid question. Is Discord the same as discuss.python.org , just by

[Python-Dev] Re: [RELEASE] The cursed fourth Python 3.11 beta (3.11.0b4) is available

2022-07-14 Thread MRAB
On 13/07/2022 12:12, h.vetin...@gmx.com wrote: Also the GH bot is using DD/MM/ date format :-( whyy? Because github is international, and everyone but the US seems to agree that ``` /\ / \ /\ / day \ /\ / \

[Python-Dev] Re: [OT] Re: Raw strings ending with a backslash

2022-05-28 Thread MRAB
On 2022-05-28 16:03, MRAB wrote: On 2022-05-28 13:17, Serhiy Storchaka wrote: 28.05.22 14:57, Damian Shaw пише: That PR seems to make \' and \" not special in general right? I think this is a more limited proposal, to only change the behavior when \ is at the end of a string, so the

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread MRAB
On 2022-05-28 13:17, Serhiy Storchaka wrote: 28.05.22 14:57, Damian Shaw пише: That PR seems to make \' and \" not special in general right? I think this is a more limited proposal, to only change the behavior when \ is at the end of a string, so the only behavior difference would never

[Python-Dev] Re: [RELEASE] The first Python 3.11 beta (3.11.0b1) is available - Feature freeze is here

2022-05-08 Thread MRAB
On 2022-05-08 04:22, Pablo Galindo Salgado wrote: We did it, team!! After quite a bumpy release process and a bunch of last-time fixes, we have reached **beta 1** and **feature freeze**. What a ride eh? You can get the shiny new release artefacts from here:

[Python-Dev] Re: PEP 689 – Semi-stable C API tier

2022-04-29 Thread MRAB
On 2022-04-30 03:17, Greg Ewing wrote: On 30/04/22 5:25 am, MRAB wrote: I was going to suggest "metastable". Too late? :-) What, the API is balanced on a knife edge and likely to collapse into something else if you sneeze too hard? There's a possibility that the universe might be

[Python-Dev] Re: PEP 689 – Semi-stable C API tier

2022-04-29 Thread MRAB
On 2022-04-29 18:02, Guido van Rossum wrote: On Fri, Apr 29, 2022 at 10:15 AM Petr Viktorin > wrote: On 29. 04. 22 16:32, Victor Stinner wrote: > Ok, let me start with the serious business: API name. > > I'm not comfortable with "semi-stable". Python

[Python-Dev] Re: Proto-PEP part 4: The wonderful third option

2022-04-26 Thread MRAB
On 2022-04-26 06:32, Larry Hastings wrote: Sorry, folks, but I've been busy the last few days--the Language Summit is Wednesday, and I had to pack and get myself to SLC for PyCon, I'll circle back and read the messages on the existing threads tomorrow.  But for now I wanted to post "the

[Python-Dev] Re: Updating inspect APIs

2022-04-17 Thread MRAB
On 2022-04-18 01:23, Steven D'Aprano wrote: On Sun, Apr 17, 2022 at 08:35:06PM +0100, MRAB wrote: You could return only the current attributes by default, but the extra attributes on demand. (Slightly strange, but backwards-compatible.) Slicing could also return what was requested, e.g. t

[Python-Dev] Re: Updating inspect APIs

2022-04-17 Thread MRAB
On 2022-04-17 18:20, Pablo Galindo Salgado wrote: Hi, We are currently debating in gh-88116 (https://github.com/python/cpython/issues/88116 ) what's the best way forward to update the APIs in the inspect module to include the new position

[Python-Dev] Re: walrus operator and expression

2022-03-28 Thread MRAB
On 2022-03-28 23:59, Chris Angelico wrote: On Tue, 29 Mar 2022 at 09:53, Ethan Furman wrote: In the following bit of code: while s := input.read(MAXBINSIZE): while len(s) < MAXBINSIZE and ns := input.read(MAXBINSIZE-len(s)): s += ns line =

[Python-Dev] Re: Are "Batteries Included" still a Good Thing? [was: It's now time to deprecate the stdlib urllib module]

2022-03-27 Thread MRAB
On 2022-03-27 19:52, Dan Stromberg wrote: On Sat, Mar 26, 2022 at 5:58 PM Ethan Furman > wrote: [apologies for the late post, just found this in my drafts folder] On 2/7/22 12:49 AM, Stéfane Fermigier wrote: > 3. Overall, I think the days where

[Python-Dev] Re: I want to contribute to Python.

2022-02-06 Thread MRAB
On 2022-02-06 13:18, Ezekiel Adetoro wrote: Hello, My name is Ezekiel, and it is my desire to start contributing to Python, be part of the core development of Python. I have forked the CPython and cloned it. What is the next step I need to do? Look on the issue tracker for a bug that you can

[Python-Dev] Re: 3.11 enhanced error location - can it be smarter?

2022-01-18 Thread MRAB
On 2022-01-18 21:58, Pablo Galindo Salgado wrote: The code that computes the lines is already quite complex (to the point that has to do some AST analysis and post-parsing) so I am quite worried to introduce a lot of complexity in this area. I am fine doing something that we can easily check

[Python-Dev] Re: Function Prototypes

2021-12-23 Thread MRAB
On 2021-12-23 19:04, asleep.c...@gmail.com wrote: Hello and thank you for the much needed feedback. One thing that you must consider is that function prototypes have a few implications beyond typing but it seems like you're only looking at it as a tool for type hinting. The interpreter will

[Python-Dev] Re: Python 3.10 vs 3.8 performance degradation

2021-12-19 Thread MRAB
On 2021-12-19 20:06, Tigran Aivazian wrote: So far I have narrowed it down to a block of code in solve.py doing a lot of multi-threaded FFT (i.e. with fft(..., threads=6) of pyFFTW), as well as numpy exp() and other functions and pure Python heavy list manipulation (yes, lists, not numpy

[Python-Dev] Re: Optimizing literal comparisons and contains

2021-11-28 Thread MRAB
On 2021-11-29 00:52, Christopher Barker wrote: I will frequently do simple computation with literals to make my code more clear: t = 2 * 3600  # 2 hours in seconds But I see no need to optimize this kind of thing -- it would never be in a tight loop. The suggestion was specifically about

[Python-Dev] Re: Preventing Unicode-related gotchas (Was: pre-PEP: Unicode Security Considerations for Python)

2021-11-14 Thread MRAB
On 2021-11-14 17:17, Christopher Barker wrote: On Sat, Nov 13, 2021 at 2:03 PM > wrote: def 횑퓮햑풍표(): __     try: 픥e헅핝횘︴ = "Hello" 함픬r퓵ᵈ﹎ = "World"     ᵖ햗퐢혯퓽(f"{헵e퓵픩º_}, {햜ₒ풓lⅆ︴}!")     except 퓣핪ᵖe햤헿ᵣ햔횛 as

[Python-Dev] Re: containment and the empty container

2021-11-08 Thread MRAB
On 2021-11-09 00:27, Cameron Simpson wrote: On 08Nov2021 23:32, MRAB wrote: >On 2021-11-08 22:10, Cameron Simpson wrote: >>>{} in {1:'a', 'b':2] <-- TypeError because of hashability >>>set() in {1, 2, 'a', 'b'} <-- ditto >>>[] in ['a', 'b', 1, 2] <

[Python-Dev] Re: containment and the empty container

2021-11-08 Thread MRAB
On 2021-11-08 22:10, Cameron Simpson wrote: Note: I know you understand all this, I'm not "explaining" how things work below, I'm explaining how/why I think about how these work. On 08Nov2021 13:43, Ethan Furman wrote: When is an empty container contained by a non-empty container? [...] For

[Python-Dev] Re: Documenting Python versioning and stability expectations

2021-10-16 Thread MRAB
On 2021-10-16 22:39, Oscar Benjamin wrote: On Fri, 15 Oct 2021 at 14:12, Petr Viktorin wrote: Most of this is, hopefully, just capturing existing tribal knowledge, but: [snip] Micro Versions -- A new micro version marks *bugfix* and *security* releases. These releases are

[Python-Dev] Re: Packing a long list of numbers into memory

2021-10-10 Thread MRAB
On 2021-10-10 19:20, Gregory P. Smith wrote: On Sun, Oct 10, 2021 at 7:25 AM Facundo Batista mailto:facundobati...@gmail.com>> wrote: Hello everyone! I need to pack a long list of numbers into shared memory, so I thought about using `struct.pack_into`. Its signature is

[Python-Dev] Re: PEP 654 except* formatting

2021-10-05 Thread MRAB
On 2021-10-06 02:12, Barry Warsaw wrote: What do the PEP authors think about `except group`? Bikeshedding aside, that’s still the best alternative I’ve seen. It’s unambiguous, self-descriptive, and can’t be confused with unpacking syntax. +1 ___

[Python-Dev] Re: PEP 654 except* formatting

2021-10-04 Thread MRAB
On 2021-10-04 16:02, Jonathan Goble wrote: On Mon, Oct 4, 2021 at 1:24 AM Guido van Rossum > wrote: On Sun, Oct 3, 2021 at 9:20 PM Jonathan Goble mailto:jcgob...@gmail.com>> wrote: Therefore my vote is for requiring `except* E` and keeping `except

[Python-Dev] Re: PEP 654 except* formatting

2021-10-04 Thread MRAB
On 2021-10-04 07:12, Greg Ewing wrote: On 4/10/21 6:23 pm, Guido van Rossum wrote: On Sun, Oct 3, 2021 at 9:20 PM Jonathan Goble > wrote: Therefore my vote is for requiring `except* E` and keeping `except *E` as a SyntaxError. You can't do that with our

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread MRAB
On 2021-10-03 18:50, Brandt Bucher wrote: Łukasz Langa wrote: My idea is this: try: ... except group E as e: ... except group E1, T2 as e: ... Should be doable given the magical match-case contextual keywords precedent. This looks nice and is explicit, since you will always get an

[Python-Dev] Re: Worried about Python release schedule and lack of stable C-API

2021-09-25 Thread MRAB
On 2021-09-26 00:14, jack.jan...@cwi.nl wrote: I’m getting increasingly worried about the future of Python, and those worries have been exacerbated by the new yearly release rhythm, and the lack of a stable C-API that is full enough to entice extension writers to use it. PyPI packages and

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-08 Thread MRAB
On 2021-09-09 00:29, Rob Cliffe via Python-Dev wrote: On 08/09/2021 21:21, Christopher Barker wrote: [snip] NOTE: my objection to “bchr”, whether as a builtin or not is not the functionality, it’s the name. [snip] Why not byte() ? I happened to need to convert an integer to a byte

[Python-Dev] Re: PEP 467 feedback from the Steering Council

2021-09-08 Thread MRAB
On 2021-09-08 13:37, Victor Stinner wrote: On Wed, Sep 8, 2021 at 7:46 AM Steven D'Aprano wrote: >>> bytes.from_int(121404708502361365413651784, 'little') # should return b'Hello world' Really? I don't know anyone serializing strings as a "bigint" number. Did you already see such

[Python-Dev] Re: PEP 667: Consistent views of namespaces

2021-08-24 Thread MRAB
On 2021-08-24 17:55, Patrick Reader wrote: On 24/08/2021 06:27, Steven D'Aprano wrote: Wouldn't that attempt to resolve global y, rather than local y? Unless there is a change to the current behaviour of the compiler, I think you need to fool the compiler: if False: y = 0 # anywhere

[Python-Dev] Re: Problems with dict subclassing performance

2021-08-15 Thread MRAB
On 2021-08-15 22:50, Marco Sulla wrote: On Sun, 15 Aug 2021 at 23:33, Tim Peters wrote:ople have said now, including me, they had no idea what you meant.by "I pretend your immediate excuses". It's not a complaint that it's expressed inelegantly, but that they can't make _any_ sense of it. By

[Python-Dev] Re: New __main__.rst

2021-08-10 Thread MRAB
On 2021-08-10 03:14, Jack DeVries wrote: There have been a series of requests to enhance the current __main__.rst document : bpo-17359 bpo-24632 bpo-39452

[Python-Dev] Re: The repr of a sentinel

2021-05-23 Thread MRAB
On 2021-05-24 01:37, Luciano Ramalho wrote: Sorry about my detour into the rejected idea of a factory function. But how about this class-based API? class NotGiven(Sentinel): pass Now I can use NotGiven as the sentinel, and its default repr is . The repr of other singletons are the

[Python-Dev] Re: GDB not breaking at the right place

2021-05-23 Thread MRAB
On 2021-05-23 14:56, Skip Montanaro wrote: I strongly suggest to only build Python with -O0 when using gdb. -Og enables too many optimizations which makes gdb less usable. Thanks, Victor. It never made sense to me that you would want any optimizations enabled when truly debugging code (as

[Python-Dev] Re: Future PEP: Include Fine Grained Error Locations in Tracebacks

2021-05-07 Thread MRAB
On 2021-05-08 01:43, Pablo Galindo Salgado wrote: Some update on the numbers. We have made some draft implementation to corroborate the numbers with some more realistic tests and seems that our original calculations were wrong. The actual increase in size is quite bigger than previously

[Python-Dev] Re: Future PEP: Include Fine Grained Error Locations in Tracebacks

2021-05-07 Thread MRAB
On 2021-05-07 22:56, Larry Hastings wrote: On 5/7/21 2:45 PM, Pablo Galindo Salgado wrote: Given that column numbers are not very big compared with line numbers, we plan to store these as unsigned chars or unsigned shorts. We ran some experiments over the standard library and we found that the

[Python-Dev] Re: Future PEP: Include Fine Grained Error Locations in Tracebacks

2021-05-07 Thread MRAB
On 2021-05-07 22:45, Pablo Galindo Salgado wrote: Hi there, We are preparing a PEP and we would like to start some early discussion about one of the main aspects of the PEP. The work we are preparing is to allow the interpreter to produce more fine-grained error messages, pointing to the

[Python-Dev] Re: stdlib Flag Enums and the "no value" member

2021-04-29 Thread MRAB
On 2021-04-29 18:56, Ethan Furman wrote: On 4/29/21 10:52 AM, Antoine Pitrou wrote: > On Thu, 29 Apr 2021 18:37:29 +0100, MRAB wrote: >> On 2021-04-29 18:19, Ethan Furman wrote: >>> An excerpt from bpo-31369: re.RegexFlag and `__all__` >>> >>> Gv

[Python-Dev] Re: stdlib Flag Enums and the "no value" member

2021-04-29 Thread MRAB
On 2021-04-29 18:19, Ethan Furman wrote: An excerpt from bpo-31369: re.RegexFlag and `__all__` GvR: > One thing I discovered when developing this example: there doesn't seem to be a flag to > represent 0 (zero), i.e. "no flags". And foo(0) is a type error (even though it works >

[Python-Dev] Re: str() vs format(): trivia question

2021-04-20 Thread MRAB
On 2021-04-20 20:42, Ethan Furman wrote: On 4/20/21 12:01 PM, Guido van Rossum wrote: > On Tue, Apr 20, 2021 at 11:12 AM Ethan Furman wrote: >> Moving forward, I'm not sure having format() and str() ever be different >> is a good idea, especially since users who need, for example,

[Python-Dev] Re: PEP-376 and PEP-427 interpretation

2021-03-26 Thread MRAB
On 2021-03-27 01:54, Theallredman via Python-Dev wrote: Forgive me if this isn't the correct venue for this question and I ask your help directing me to the correct place if it is not. In PEP-376 it states with respect to the valid hashes in a Wheel RECORD file: "The hash is either the

[Python-Dev] Re: Non-monotonically increasing line numbers in dis.findlinestarts() output

2021-03-17 Thread MRAB
On 2021-03-17 22:10, Skip Montanaro wrote: Consider this little session from the tip of the spear: >>> sys.version '3.10.0a6+ (heads/master:0ab152c6b5, Mar 15 2021, 17:24:38) [GCC 10.2.0]' >>> def while2(a): ...     while a >= 0: ...         a -= 1 ...     return a ... >>> dis.dis(while2)  

[Python-Dev] Re: Steering Council update for February

2021-03-10 Thread MRAB
On 2021-03-10 15:17, Antoine Pitrou wrote: On Wed, 10 Mar 2021 14:23:33 + David Mertz wrote: Renaming main branches as 'main' is currently predominant practice on GitHub (and more broadly in Free Software communities). Python doesn't need to cling to an old name based on a tired argument

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-23 Thread MRAB
On 2021-02-23 23:05, Caleb Donovick wrote: What is the motivation for returning `None` on empty splits?  I feel like this creates an unnecessary asymmetry.  I don't personally have a use case for the this feature so I may be missing something but it seems like it would force an annoying

[Python-Dev] Re: Why aren't we allowing the use of C11?

2021-01-28 Thread MRAB
On 2021-01-28 19:20, Terry Reedy wrote: On 1/28/2021 11:26 AM, Mark Shannon wrote: PEP 7 says that C code should conform to C89 with a subset of C99 allowed. As I remember, when the Python C dialect was discussed about 4 years ago, no one seriously proposed moving beyond a subset of C99

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-27 Thread MRAB
On 2020-12-27 19:15, Guido van Rossum wrote: On Sun, Dec 27, 2020 at 3:19 AM Ronald Oussoren > wrote: On 26 Dec 2020, at 18:43, Guido van Rossum mailto:gu...@python.org>> wrote: On Sat, Dec 26, 2020 at 3:54 AM Phil Thompson via Python-Dev

[Python-Dev] Re: Advice / RTFM needed for tool setup to participate in python development from a Windows host

2020-12-16 Thread MRAB
On 2020-12-16 19:19, Paul Moore wrote: Personally, I just have Visual Studio and VS Code as my text editor. I rarely use Visual Studio directly, though, I mostly use the `build.bat` and similar scripts in the `PCBuild` directory. Having said that, I'm not doing anything like debugging problems

[Python-Dev] Re: Why does "except Ex as x" not restore the previous value of x?

2020-11-17 Thread MRAB
On 2020-11-18 03:36, Larry Hastings wrote: [snip] But then we get to generator expressions and list/dict/set comprehensions.  I think of those as doing an "assignment", but I have to remember the assignment "doesn't leak": x = 3 y = list(x**2 for x in range(5)) print(f"{x=}")

[Python-Dev] Re: PEP 642 v2: Explicit constraint patterns *without* question marks in the syntax

2020-11-16 Thread MRAB
On 2020-11-16 08:54, Glenn Linderman wrote: On 11/15/2020 11:18 PM, Stephen J. Turnbull wrote: Jim J. Jewett writes: > What advantage can there be in re-using syntax to mean something > opposite to what it normally does? In math, it allows us to write "solve c = f(x) for x". That doesn't

[Python-Dev] Re: Pattern Matching controversy: Don't read PEP 635, read DLS'20 paper instead

2020-11-15 Thread MRAB
On 2020-11-15 09:48, Paul Sokolovsky wrote: Hello, As was mentioned many times on the list, PEP634-PEP636 are thoroughly prepared and good materials, many thanks to their authors. PEP635 "Motivation and Rationale" (https://www.python.org/dev/peps/pep-0635/) stands out among the 3 however: while

[Python-Dev] Re: PEP 642 v2: Explicit constraint patterns *without* question marks in the syntax

2020-11-12 Thread MRAB
On 2020-11-12 19:21, Paul Sokolovsky wrote: Hello, [Re-routed back to python-dev.] On Thu, 12 Nov 2020 20:04:57 +0100 Piotr Duda wrote: [] > match foo: > case ("foo", >val1): > ... > case ("bar", >val2): > ... > I agree with that, though I would prefer using

[Python-Dev] Re: Pattern matching reborn: PEP 622 is dead, long live PEP 634, 635, 636

2020-10-22 Thread MRAB
On 2020-10-22 17:48, Guido van Rossum wrote: After the pattern matching discussion died out, we discussed it with the Steering Council. Our discussion ended fairly positive, but there were a lot of problems with the text. We decided to abandon the old PEP 622 and break it up into three parts:

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-08-03 Thread MRAB
On 2020-08-03 05:21, Guido van Rossum wrote: Your point about wanting a way to use an unqualified name as a value pattern is not unreasonable, and as you may recall we had an elegant solution in version 1 of the PEP: a leading dot. However that was booed away by the critics, and there has been

[Python-Dev] Re: How to customize CPython to a minimal set

2020-07-21 Thread MRAB
On 2020-07-21 06:33, Huang, Yang wrote: Hi, Guido Yes. Micropyhton is also in consideration. But sqlite3 is the first usage. There should be some additional features like numpy, scipy... Not sure if micropython supports well? Or is there a feasible way to strip CPython ? Thanks. You want

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-16 Thread MRAB
On 2020-07-16 19:05, Richard Damon wrote: On Jul 16, 2020, at 1:36 PM, Chris Angelico wrote: On Fri, Jul 17, 2020 at 3:25 AM Federico Salerno wrote: Tools should adapt to the language, not the other way around. If things had to be done the way they had always been done, without any change,

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-16 Thread MRAB
On 2020-07-16 17:37, Steve Holden wrote: While I understand the point of view that says that match ... : should encapsulate a sequence of indented suites, it seems to me that match/case/case/.../else has a natural affinity with try/except/except/.../finally/else, and nobody seems to think that

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-12 Thread MRAB
On 2020-07-12 23:20, Guido van Rossum wrote: [snip] The need for a wildcard pattern has already been explained -- we really want to disallow `Point(x, y, y)` but we really need to allow `Point(z, _, _)`. Generating code to assign the value to `_` seems odd given the clear intent to *ignore*

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-11 Thread MRAB
On 2020-07-12 01:32, Chris Angelico wrote: On Sun, Jul 12, 2020 at 10:30 AM Greg Ewing wrote: Just had another thought about marking assignment targets. The PEP currently forbids repeating bound names in a pattern to avoid raising expectations that case Point(x, x): would match only

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-11 Thread MRAB
On 2020-07-11 20:56, Steve Holden wrote: Given that case will be a keyword, what's the case (pun unintentional) for indenting the case clauses? What's wrong with 'case' and 'else' both indented the same as match? Without the keyword there'd be a case for indenting, but with it I don't see the

[Python-Dev] Re: PEP 622: Structural Pattern Matching -- followup

2020-07-08 Thread MRAB
On 2020-07-08 03:08, Rob Cliffe via Python-Dev wrote: Why not use '=' to distinguish binding from equality testing:     case Point(x, =y): # matches a Point() with 2nd parameter equal to y; if it does, binds to x. This would allow a future (or present!) extension to other relative operators:

[Python-Dev] Re: PEP 622 railroaded through?

2020-07-07 Thread MRAB
On 2020-07-08 02:20, Greg Ewing wrote: On 8/07/20 12:48 pm, Chris Angelico wrote: "for x[0] in iter:" uses x[0] as an assignment target, You're right, there are some others, but I think they're equally clear -- all the ones I can think of are directly after a keyword ("for", "as", "import",

[Python-Dev] Re: [Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-07-04 Thread MRAB
On 2020-07-04 21:07, Martin Dengler wrote: On Sat, Jul 04, 2020 at 05:51:04PM +0100, MRAB wrote: >I'd also add: Try to avoid regionalisms; aim for a >broadly "international" form of the language. Some How do you spell "regionalism"? Martin PS: Irony intended As

[Python-Dev] Re: Recent PEP-8 change

2020-07-04 Thread MRAB
On 2020-07-04 19:23, Paul Moore wrote: On Sat, 4 Jul 2020 at 17:48, MRAB wrote: > > On 2020-07-04 05:51, Greg Ewing wrote: > > On 4/07/20 4:33 am, Jim J. Jewett wrote: > >> If Bob and Alice seem neutral to you, would you do a double-take on Kehinde or Oladotun? > &

[Python-Dev] Re: [Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-07-04 Thread MRAB
On 2020-07-04 16:23, Stephen J. Turnbull wrote: @Inada-sama: For RFC conformance to S, see footnote [3] at the end. MRAB writes: > If you believe you have something important to say, then at least > say it clearly. Indeed -- that commit log is an example of the kind of w

[Python-Dev] Re: Recent PEP-8 change

2020-07-04 Thread MRAB
On 2020-07-04 05:51, Greg Ewing wrote: On 4/07/20 4:33 am, Jim J. Jewett wrote: If Bob and Alice seem neutral to you, would you do a double-take on Kehinde or Oladotun? Maybe we should use randomly generated names for hypothetical persons? Ideally they should be short names, one or two

[Python-Dev] Re: Recent PEP-8 change (Antoine Pitrou)

2020-07-03 Thread MRAB
On 2020-07-03 17:52, Jim J. Jewett wrote: Specifying British English (as opposed to just British spelling) would probably tempt people to use more Brit-only idioms, in the same way that Monty Python tempts people to make Flying Circus references. I don't love the idea of talking more about

[Python-Dev] Re: [Python-ideas] Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-07-02 Thread MRAB
On 2020-07-02 22:17, Jeff Allen wrote: On 01/07/2020 21:01, Ethan Furman wrote: A not-great article, White Fears of Dispossession: Dreyer's English, The Elements of Style,and the Racial Mapping of English Discourse, here:

[Python-Dev] Re: Recent PEP-8 change

2020-07-02 Thread MRAB
On 2020-07-02 18:19, David Mertz wrote: On Thu, Jul 2, 2020 at 12:58 PM Piper Thunstrom > wrote: > TL;DR: It's not a recent usage; it was OK in 1375. Forgive me for not giving a detailed play by play of 15 years of experience specifically as a writer

[Python-Dev] Re: Recent PEP-8 change

2020-07-02 Thread MRAB
On 2020-07-02 17:47, Piper Thunstrom wrote: On Thu, Jul 2, 2020 at 12:16 PM MRAB wrote: > Here's an article on singular 'they': > > https://public.oed.com/blog/a-brief-history-of-singular-they/ > > TL;DR: It's not a recent usage; it was OK in 1375. Forgive me for not giving

[Python-Dev] Re: Recent PEP-8 change

2020-07-02 Thread MRAB
On 2020-07-02 17:14, Paul Moore wrote: On Thu, 2 Jul 2020 at 16:53, David Mertz wrote: On Thu, Jul 2, 2020, 11:08 AM Piper Thunstrom Paul, this is actually a good question to ask. In general, singular "they" is becoming more popular. It's already used frequently for the singular

[Python-Dev] Re: Flexible assignment targets

2020-07-02 Thread MRAB
On 2020-07-02 15:48, Jim J. Jewett wrote: Guido van Rossum wrote: On Wed, Jul 1, 2020 at 5:50 PM Nick Coghlan ncogh...@gmail.com wrote: > The key thing I'm hoping for in PEP 622 itself is > that "Syntactic compatibility with a possible future > enhancement to assignment statements" be

[Python-Dev] Re: Recent PEP-8 change

2020-07-02 Thread MRAB
On 2020-07-02 15:19, Piper Thunstrom wrote: On Thu, Jul 2, 2020 at 10:01 AM Paul Moore wrote: What *is* the correct inclusive way to refer to an unidentified person in a technical document, without sacrificing clarity by using convoluted circumlocutions like "he/her/they" or over-use of the

[Python-Dev] Re: Recent PEP-8 change

2020-07-02 Thread MRAB
On 2020-07-02 12:32, Greg Ewing wrote: On 2/07/20 10:53 pm, MRAB wrote: Alternatively, it could be an auxiliary language like Esperanto. Maybe Esperanto in particular wouldn't be the best choice -- I gather it's rather European-oriented. Maybe we should standardise on Klingon? Humans of all

[Python-Dev] Re: Recent PEP-8 change

2020-07-02 Thread MRAB
On 2020-07-02 10:38, Chris Angelico wrote: On Thu, Jul 2, 2020 at 7:27 PM Antoine Pitrou wrote: Otherwise why stop at English? I could just as well write my comments in French if it's all about individual freedom. Requiring English is not inclusive, it forced people like me to painfully adapt

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-25 Thread MRAB
On 2020-06-25 08:50, Anders Munch wrote: Eric Nieuwland : I have some doubt about the keyword Guido van Rossum [mailto:gu...@python.org]: Many people have tried to come up with a different keyword here, but nothing has been found that comes even close to the simplicity of match. Plus, several

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-25 Thread MRAB
On 2020-06-25 04:54, Greg Ewing wrote: I had another thought about a way to make the bound names explicit. # Keyword case Point(x -> px, y -> py): # Positional case Point(-> x, -> y): # Sub-pattern, positional case Line(Point() -> p1, Point() -> p2): #

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread MRAB
On 2020-06-24 23:14, Ethan Furman wrote: On 06/24/2020 01:49 PM, Tim Peters wrote: I too thought "why not else:?" at first. But "case _:" covers it in the one obvious way after grasping how general wildcard matches are. "case _:" is easy to miss -- I missed it several times reading through

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread MRAB
On 2020-06-24 13:37, Antoine Pitrou wrote: On Wed, 24 Jun 2020 21:54:24 +1200 Greg Ewing wrote: On 24/06/20 5:20 am, Antoine Pitrou wrote: > suddently `Point(x, 0)` means something entirely > different (it doesn't call Point.__new__, it doesn't lookup `x` in the > locals or globals...).

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread MRAB
On 2020-06-24 01:09, Guido van Rossum wrote: On Tue, Jun 23, 2020 at 4:41 PM MRAB <mailto:pyt...@mrabarnett.plus.com>> wrote: [snip] However, what if you wanted to match Ellipsis? This could lead to bugs:  >>> ... Ellipsis  >>> Ellipsis

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread MRAB
On 2020-06-23 22:50, Barry Warsaw wrote: On Jun 23, 2020, at 14:31, Chris Angelico wrote: I can't find it among the rejected alternatives, but was it considered to use "..." as the wildcard, rather than "_"? It carries similar meaning but its special case of "this will never be bound" is

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread MRAB
On 2020-06-23 22:53, Emily Bowman wrote: On Tue, Jun 23, 2020 at 2:10 PM MRAB <mailto:pyt...@mrabarnett.plus.com>> wrote: I think that's done for consistency. '_' is a wildcard and you can have:      case (_, _): to match any 2-tuple, so:      case _: would

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread MRAB
On 2020-06-23 18:20, Antoine Pitrou wrote: Some comments: * What you call "Constant Value Patterns" can really refer to any local or non-local name, regardless of how complex the referred object is, right? Also, __eq__ is called in that case, not __match__? * If I understand correctly,

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread MRAB
On 2020-06-23 20:27, Rob Cliffe via Python-Dev wrote: On 23/06/2020 17:01, Guido van Rossum wrote: You can combine several literals in a single pattern using `|` ("or"): ```py         case 401|403|404:             return "Not allowed" The PEP is great, but this strikes me as horribly

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-23 Thread MRAB
On 2020-06-23 17:01, Guido van Rossum wrote: I'm happy to present a new PEP for the python-dev community to review. This is joint work with Brandt Bucher, Tobias Kohn, Ivan Levkivskyi and Talin. Many people have thought about extending Python with a form of pattern matching similar to that

[Python-Dev] Re: When can we remove wchar_t* cache from string?

2020-06-12 Thread MRAB
On 2020-06-12 09:32, Inada Naoki wrote: Hi, all. Py_UNICODE has been deprecated since PEP 393 (Flexible string representation). wchar_t* cache in the string object is used only in deprecated APIs. It waste 1 word (8 bytes on 64bit machine) per string instance. The deprecated APIs are

[Python-Dev] Re: Repr: where to place the address and additional info?

2020-05-29 Thread MRAB
On 2020-05-29 21:02, Serhiy Storchaka wrote: The default repr of Python object is formatted using the following pattern: <{typename} object at {address:#x}> And many custom reprs use similar patterns, but add some additional type specific information. The type name first, followed by

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-20 Thread MRAB
On 2020-05-21 00:29, Emily Bowman wrote: Python has always preferred full-word over old-school C/Perl/PHP-style abbreviated names. Clarity is paramount. (Or this whole discussion wouldn't even be happening.) [snip] ... apart from len, def, int, float, str, etc.

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-15 Thread MRAB
On 2020-05-15 20:36, David Mertz wrote: On Fri, May 15, 2020 at 12:55 PM Eric V. Smith > wrote: Also: The PEP says "At most one additional item may be consumed from one of the iterators when compared to normal zip usage." I think this should be prefaced

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-22 Thread MRAB
On 2020-03-22 05:00, Dennis Sweeney wrote: I like "removeprefix" and "removesuffix". My only concern before had been length, but three more characters than "cut***fix" is a small price to pay for clarity. How about "dropprefix" and "dropsuffix"? ___

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-20 Thread MRAB
On 2020-03-20 21:49, Dennis Sweeney wrote: For clarity, I'll change If ``s`` does not have ``pre`` as a prefix, an unchanged copy of ``s`` is returned. to If ``s`` does not have ``pre`` as a prefix, then ``s.cutprefix(pre)`` returns ``s`` or an unchanged copy of ``s``. For

[Python-Dev] Re: Request to postpone some Python 3.9 incompatible changes to Python 3.10

2020-01-31 Thread MRAB
On 2020-01-31 19:58, Ethan Furman wrote: On 01/31/2020 10:47 AM, Mike Miller wrote: On 2020-01-23 07:20, Victor Stinner wrote: Python 3.9 introduces many small incompatible changes which broke tons There's a well-known and established way of signaling breaking changes in software

[Python-Dev] Re: Python 3.8 error?

2019-12-09 Thread MRAB
On 2019-12-09 18:22, Christian Tismer wrote: On 08.12.19 09:49, Nick Coghlan wrote: On Fri., 6 Dec. 2019, 3:31 am Christian Tismer, mailto:tis...@stackless.com>> wrote: Hi guys, during the last few weeks I have been struggling quite much in order to make PySide run with Python 3.8

[Python-Dev] Re: Implementation of PEP-0604

2019-11-17 Thread MRAB
On 2019-11-17 20:09, Ivan Levkivskyi wrote: To add some more input about forward references, here are couple of thoughts: 1. I think ideally we should support forward references to the same extent they are currently supported: i.e. Union[None, "ForwardRef"], Union["OtherForwardRef", None],

[Python-Dev] Re: [RELEASE] Python 3.8.0 is now available

2019-10-15 Thread MRAB
On 2019-10-15 19:03, MRAB wrote: On 2019-10-14 21:23, Łukasz Langa wrote: On behalf of the Python development community and the Python 3.8 release team, I’m pleased to announce *the availability of Python 3.8.0*. [snip] I've installed pywin32 on Python 3.8, but when I try to import

[Python-Dev] Re: [RELEASE] Python 3.8.0 is now available

2019-10-15 Thread MRAB
On 2019-10-14 21:23, Łukasz Langa wrote: On behalf of the Python development community and the Python 3.8 release team, I’m pleased to announce *the availability of Python 3.8.0*. [snip] I've installed pywin32 on Python 3.8, but when I try to import win32clipboard it says it can't find it:

  1   2   3   4   5   6   >