[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:

[Python-Dev] Compacting the Uncompactable

2019-09-28 Thread MRAB
Here's a video about memory fragmentation and compaction that you might find interesting: "Compacting the Uncompactable" by Bobby Powers https://www.youtube.com/watch?v=c1UBJbfR-H0 ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe

[Python-Dev] Re: static variables in CPython - duplicated _Py_IDENTIFIERs?

2019-09-23 Thread MRAB
On 2019-09-23 21:22, Vinay Sajip via Python-Dev wrote: OK - but that's just one I picked at random. There are others like it - what would be the process for deciding which ones need to be made private and moved? Should an issue be raised to track this? It's not really a question of which ones

[Python-Dev] Re: Spammy stuff (was Re: congrats on 3.5! Alas, windows 7 users are having problems installing it)

2019-09-15 Thread MRAB
On 2019-09-15 23:40, Michael Foord wrote: Sent from my iPhone On 15 Sep 2019, at 23:25, Tim Peters wrote: [Tim] While python-dev has several "official" moderators, best I can tell I'm the only one who has reviewed these messages for years. I should clarify that! That's not meant to be

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-09 Thread MRAB
On 2019-08-09 23:56, Steven D'Aprano wrote: I'm not trying to be confrontational, I'm trying to understand your use-case(s) and see if it would be broken by the planned change to string escapes. On Fri, Aug 09, 2019 at 03:18:29PM -0700, Glenn Linderman wrote: On 8/9/2019 2:53 PM, Steven

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-07 Thread MRAB
On 2019-08-07 23:43, Steve Holden wrote: This whole thread would be an excellent justification for following 3.9 with 4.0. It's as near as we ever want to get to a breaking change, and a major version number would indicate the need to review. If increasing strictness of escape code

[Python-Dev] Re: What to do about invalid escape sequences

2019-08-06 Thread MRAB
On 2019-08-06 17:32, Matt Billenstein wrote: On Mon, Aug 05, 2019 at 04:22:50AM -, raymond.hettin...@gmail.com wrote: This once seemed like a reasonable and innocuous idea to me; however, I've been using the 3.8 beta heavily for a month and no longer think it is a good idea. The warning

[Python-Dev] Re: Comparing dict.values()

2019-07-23 Thread MRAB
On 2019-07-23 21:59, Kristian Klette wrote: Hi! During the sprints after EuroPython, I made an attempt at adding support for comparing the results from `.values()` of two dicts. Currently the following works as expected: ``` d = {'a': 1234} d.keys() == d.keys() d.items() == d.items() ```

[Python-Dev] Re: strip behavior provides inconsistent results with certain strings

2019-06-28 Thread MRAB
On 2019-06-28 03:40, Glenn Linderman wrote: On 6/27/2019 3:09 PM, Brett Cannon wrote: My guess is that without Guido to just ask this will have to go to a PEP as it changes a built-in. How does adding two new methods change a built-in? Now if an extra parameter were added to modify lstrip,

[Python-Dev] Re: Who uses libpython38.a on Windows?

2019-06-14 Thread MRAB
On 2019-06-14 21:53, Steve Dower wrote: One of the most annoying steps in building the Windows installers is generating the libpython38.a file. It's annoying, because it requires having "generic enough" MinGW tools to ensure that the file is compatible with whatever version of MinGW might be

Re: [Python-Dev] [PEP 558] thinking through locals() semantics

2019-06-02 Thread MRAB
On 2019-06-02 13:51, Steven D'Aprano wrote: On Sun, Jun 02, 2019 at 11:52:02PM +1200, Greg Ewing wrote: Armin Rigo wrote: >You have the occasional big function that benefits a lot from being >JIT-compiled but which contains ``.format(**locals())``. There should be a lot less need for that now

Re: [Python-Dev] Python in next Windows 10 update

2019-05-21 Thread MRAB
On 2019-05-21 21:30, Steve Dower wrote: [snip] The associated blog post: https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/ Here are answers to a few questions that I assume will come up, at least from this audience that understands the issues better than most: *

Re: [Python-Dev] (no subject)

2019-04-10 Thread MRAB
On 2019-04-10 22:00, Terry Reedy wrote: On 4/10/2019 7:24 AM, Robert Okadar wrote: Hi community, I have developed a tkinter GUI component, Python v3.7. It runs very well in Linux but seeing a huge performance impact in Windows 10. While in Linux an almost real-time performance is achieved, in

Re: [Python-Dev] Best way to specify docstrings for member objects

2019-03-19 Thread MRAB
On 2019-03-19 18:55, Raymond Hettinger wrote: I'm working on ways to make improve help() by giving docstrings to member objects. One way to do it is to wait until after the class definition and then make individual, direct assignments to __doc__ attributes.This way widely the separates

Re: [Python-Dev] Summary of Python tracker Issues

2019-02-28 Thread MRAB
On 2019-02-28 23:54, Glenn Linderman wrote: On 2/28/2019 2:52 PM, Terry Reedy wrote: On 2/28/2019 5:38 PM, Glenn Linderman wrote: On 2/28/2019 2:18 PM, Jonathan Goble wrote: On Thu, Feb 28, 2019, 5:11 PM Terry Reedy > wrote:     On 2/28/2019 8:07 AM, Jonathan Goble

Re: [Python-Dev] Making PyInterpreterState an opaque type

2019-02-21 Thread MRAB
On 2019-02-21 12:53, Antoine Pitrou wrote: On Thu, 21 Feb 2019 13:45:05 +0100 Victor Stinner wrote: Le jeu. 21 févr. 2019 à 12:36, Antoine Pitrou a écrit : > > On Thu, 21 Feb 2019 12:13:51 +0100 > Victor Stinner wrote: > > > > Premature optimization is the root of all evil. Most C

Re: [Python-Dev] Add more SyntaxWarnings?

2019-01-30 Thread MRAB
On 2019-01-30 18:12, Stefan Behnel wrote: MRAB schrieb am 29.01.19 um 19:55: On 2019-01-29 13:44, Nick Coghlan wrote: FWIW, we have pretty decent evidence that error messages don't have to provide a wonderful explanation on their own in order to be helpful: they just need to be distinctive

Re: [Python-Dev] Add more SyntaxWarnings?

2019-01-29 Thread MRAB
On 2019-01-29 13:44, Nick Coghlan wrote: On Tue, 29 Jan 2019 at 14:47, Stephen J. Turnbull wrote: I don't disagree. I disagree with the conclusion that it's worth the effort to try to improve all error messages that confuse new users, because new users (by definition) don't know enough to

Re: [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-18 Thread MRAB
On 2019-01-19 00:28, Greg Ewing wrote: Tim Peters wrote: The dict itself keeps the objects alive. Yes, but the idea of a cache is that you're free to flush things out of it to make room for something else without breaking anything. It sounds like MRAB is using ids as weak references

Re: [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-18 Thread MRAB
On 2019-01-18 23:02, Greg Ewing wrote: MRAB wrote: If I want to cache some objects, I put them in a dict, using the id as the key. If I wanted to locate an object in a cache and didn't have id(), I'd have to do a linear search for it. That sounds dangerous. An id() is only valid as long

Re: [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

2019-01-17 Thread MRAB
On 2019-01-18 00:48, Gregory P. Smith wrote: I've heard that libraries using ctypes, cffi, or cython code of various sorts in the real world wild today does abuse the unfortunate side effect of CPython's implementation of id(). I don't have specific instances of this in mind but trust what

Re: [Python-Dev] C API changes

2018-11-26 Thread MRAB
On 2018-11-27 00:08, Larry Hastings wrote: On 11/23/18 5:15 AM, Armin Rigo wrote: Also FWIW, my own 2 cents on the topic of changing the C API: let's entirely drop ``PyObject *`` and instead use more opaque handles---like a ``PyHandle`` that is defined as a pointer-sized C type but is not

Re: [Python-Dev] Standardize error message for non-pickleable types

2018-10-30 Thread MRAB
On 2018-10-30 08:12, Serhiy Storchaka wrote: 29.10.18 23:17, MRAB пише: 1. If you're pickling, then saying "pickle" is more helpful. 2. In English the usual long form is "cannot". Error messages tend to avoid abbreviations, and also tend to have lowercase

Re: [Python-Dev] Standardize error message for non-pickleable types

2018-10-29 Thread MRAB
On 2018-10-29 22:21, Steven D'Aprano wrote: On Mon, Oct 29, 2018 at 08:51:34PM +0100, Victor Stinner wrote: Le lun. 29 oct. 2018 à 20:42, Serhiy Storchaka a écrit : > 1. "pickle" or "serialize"? serialize -1 Serializing is more general; pickle is merely one form of serializing:

Re: [Python-Dev] Standardize error message for non-pickleable types

2018-10-29 Thread MRAB
On 2018-10-29 19:38, Serhiy Storchaka wrote: When you try to to pickle or copy a non-pickleable object, you will get an error. In most cases this will be a TypeError with one of few similar, but different variants: "can't pickle XXX objects" (default) "Cannot serialize XXX object"

[Python-Dev] LibSSH Vulnerability

2018-10-18 Thread MRAB
I wondered if any of you have heard of this: Hacker: I'm logged in. New LibSSH Vulnerability: OK! I believe you. https://www.bleepingcomputer.com/news/security/hacker-im-logged-in-new-libssh-vulnerability-ok-i-believe-you/ ___ Python-Dev mailing list

  1   2   3   4   5   >