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

2021-02-26 Thread Emily Bowman
A side benefit is that if an Exception somehow propagates up where only ExceptionGroup is defined, except *() could just work anyway, though it might take a little magic to make sure they act the same. Like Guido said, I don't think it can be retrofitted into existing *-less APIs, and it'll either

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

2021-02-24 Thread Emily Bowman
After reading through the PEP and skimming the code (but I didn't build it), something I didn't see: What happens to a currently conforming except check? try: async with trio.open_nursery() as nursery: # Make two concurrent calls to child() nursery.start_soon(child)

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-23 Thread Emily Bowman
On Tue, Feb 23, 2021 at 4:51 PM Random832 wrote: > Why is it that this community is resigned to recommending a workaround > when distributions decide the site-packages directory belongs to their > package manager rather than pip, instead of bringing the same amount of > fiery condemnation of

[Python-Dev] Re: Deprecate support for mingw - add to PEP 11

2021-02-21 Thread Emily Bowman
On Sun, Feb 21, 2021 at 10:02 AM Dan Stromberg wrote: > > It looks like CPython remains 100% C, so clang becomes more attractive: > > https://stackoverflow.com/questions/6329688/llvm-and-visual-studio-obj-binary-incompatibility > > Then again, do we allow C++ extension modules? That might make

[Python-Dev] Re: It is really necessary to check that a object has a Py_TPFLAGS_HEAPTYPE flag?

2021-02-15 Thread Emily Bowman
On Mon, Feb 15, 2021 at 4:11 PM Victor Stinner wrote: > > I didn't use Ruby on Rails, but the feedback that I heard is that the > ability to extend built-in types is appealing, but it is problematic > in practice. > Monkeypatching's such a part of the Ruby (and Javascript) culture that there

[Python-Dev] Re: PEP 647 (type guards) -- final call for comments

2021-02-15 Thread Emily Bowman
FWIW, it would really be nice if this was called IsInstance[...]; I feel like that would neatly encapsulate its meaning to both old and new, that it's just a yes/no on whether this is an instance of [...]. TypeScript has the concept of a type guard but doesn't use that name in code, so there's no

[Python-Dev] Re: Python standardization

2021-02-12 Thread Emily Bowman
A call for standardization is typically done when multiple competing de-facto standards competing for space, especially if it's relatively immature, as a way to bring stakeholders together and reduce fragmentation. You don't just go through the standards process for its own sake, unless it's a

[Python-Dev] Re: PEP 624: Remove Py_UNICODE encoder APIs

2021-02-02 Thread Emily Bowman
On Tue, Feb 2, 2021 at 3:47 AM Inada Naoki wrote: > But when wchar_t* is UTF-16, ucs2_utf8_encoder() can not handle > surrogate escape. > We need to use a temporary Unicode object. That is what "inefficient" > means. > Since real UCS-2 is effectively dead, maybe it should be flipped around:

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

2021-01-28 Thread Emily Bowman
On Thu, Jan 28, 2021 at 1:31 PM MRAB wrote: > I have Microsoft Visual Studio Community 2019 Version 16.8.4 (it's free) > and it supports C11 and C17. While an upgrade for Community is free, for Pro/Enterprise without an annual license it's not. They've gone 100% subscription now, but people

[Python-Dev] Re: 3.10 change (?) for __bool__

2021-01-13 Thread Emily Bowman
Even if you define __bool__() as returning a bool, and error/undefined behavior otherwise, that doesn't eliminate side effects. Is it even possible to nail down a definition to the point that you can say, "Thou shalt not mutate or cause anything" and have it meaningfully enforced in the compiler

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

2020-12-16 Thread Emily Bowman
Even if Python itself is the standard distribution, you should be able to debug your outside DLL module in VS just by putting a breakpoint on your favorite line and setting "/path/to/python.exe -m yourmodule" as the command path under debugging in your project properties, or whatever commandline

[Python-Dev] Re: fail keyword like there is pass keyword

2020-10-28 Thread Emily Bowman
On Wed, Oct 28, 2020 at 6:49 AM Jean Abou Samra wrote: > where `impossible` raises AssertionError. > Reserving a common English word as a new keyword (whether fail or impossible) is the mother of all breaking changes. The syntactic sugar it provides is not only tiny, it's pretty much negative,

[Python-Dev] Re: PEP 638: Syntactic macros

2020-09-28 Thread Emily Bowman
On Mon, Sep 28, 2020 at 7:23 AM Marco Sulla wrote: > On Mon, 28 Sep 2020 at 13:56, Nick Coghlan wrote: > > For usage, whether something is a macro or not should either be > irrelevant (when they're used as a more powerful function call or > > decorator), or else entirely obvious from the way

[Python-Dev] Re: Understanding why object defines rich comparison methods

2020-09-22 Thread Emily Bowman
NotImplemented is like a pure virtual function; failing to implement it tells you that you forgot part of the contract, except at runtime instead of compile time. So if you never need them, you're free to elide them, but if you want full compatibility, you need to implement every part of it. If

[Python-Dev] Re: PEP 632: Deprecate distutils module

2020-09-05 Thread Emily Bowman
On Sat, Sep 5, 2020 at 12:37 AM Ivan Pozdeev via Python-Dev < python-dev@python.org> wrote: > As I wrote in > https://stackoverflow.com/questions/25337706/setuptools-vs-distutils-why-is-distutils-still-a-thing/40176290#40176290, > > distutils has a responsibility that setuptools as a 3rd-party

[Python-Dev] Re: PEP 632: Deprecate distutils module

2020-09-05 Thread Emily Bowman
On Fri, Sep 4, 2020 at 3:11 PM Stefan Krah wrote: > > > It is not hyperbolic at all. You can get permissions for a certain set > of modules (the stdlib), but not for PyPI packages. > > Of course the upgrade is not via the network, that is beside the point. > If you can update to a breaking

[Python-Dev] Re: PEP 632: Deprecate distutils module

2020-09-04 Thread Emily Bowman
On Fri, Sep 4, 2020 at 10:31 AM Stefan Krah wrote: > > All the time, especially when I'm writing them. I imagine that there's > a huge amount of internal company code that discourages use of pip > installed packages as well. Or has an air-gapped network in the first > place. > That's wildly

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

2020-07-18 Thread Emily Bowman
On Sat, Jul 18, 2020 at 3:29 AM wrote: > > adept at ignoring them, we will again have difficulties when debugging > > as we won't easily see them. > > Besides which, the problem is solved: > > > > namespace.var is a lookup > > var is a store > > These rules can't be deduced from a few examples,

[Python-Dev] Re: PEP 622 (match statement) playground

2020-07-08 Thread Emily Bowman
On Wed, Jul 8, 2020 at 7:03 AM Kerwin Sun wrote: > I tried with this code: > [...] > def whereis(point): > case w: > print("Not the answer, local w") > case z: > print("The answer") > case _: > print("other") > whereis(42) w, z

[Python-Dev] Re: PEP 622: Structural Pattern Matching [was: PEP 622 railroaded through?]

2020-07-07 Thread Emily Bowman
On Tue, Jul 7, 2020 at 8:37 AM Rhodri James wrote: > I'm not quite convinced about making "_" non-binding, mostly because of > the knock-on effects in the PEP for other types of patterns. It seems > to breed more special cases, and I can't help but feel that's a bad sign. > After spending some

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

2020-07-04 Thread Emily Bowman
On Sat, Jul 4, 2020 at 5:37 PM Greg Ewing wrote: > On 5/07/20 3:24 am, Stephen J. Turnbull wrote: > > Amusingly, Strunk (1918) was perfectly happy with split infinitives, > > though he noted it centered whiteness. (Obviously he didn't put it > > that way, more along the lines of "some people

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

2020-07-04 Thread Emily Bowman
I don't see how this extrapolates to arbitrary, extended match expressions? You're proposing a slightly more flexible switch, which match is only intended to be as the most basic case. Even if you purely swapped it out with any the various proposals for identifying a constant vs a target, it's

[Python-Dev] Re: PEP 620: Hide implementation details from the C API

2020-07-01 Thread Emily Bowman
On Wed, Jul 1, 2020 at 4:09 AM Antoine Pitrou wrote: > How does this help third-party extensions? > If the cost is high enough, exposing the guts of a function to allow the compiler to inline it is not unreasonable; all of the major compilers have ways to inline things that are technically

[Python-Dev] Re: Plan to remove Py_UNICODE APis except PEP 623.

2020-06-30 Thread Emily Bowman
I completely agree with this, that UTF-8 has become the One True Encoding(tm), and UCS-2 and UTF-16 are hardly found anywhere outside of the Win32 API. Nearly all basic emoji can't be represented in UCS-2 wchar_t, let alone composite emoji. So how to make that C-compatible? Make everything a

[Python-Dev] Re: PEP 620: Hide implementation details from the C API

2020-06-30 Thread Emily Bowman
On Mon, Jun 29, 2020 at 7:41 PM Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > Perhaps you don't want to believe the results, but the timings are > careful, stable, repeatable, and backed-up by a disassembly that shows the > exact cause. The builds used for the timings were the

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

2020-06-26 Thread Emily Bowman
On Fri, Jun 26, 2020 at 3:47 AM Paul Moore wrote: > For me, this prompts the question (which I appreciate is more about > implementation than design) - would there be any (significant) > performance difference between [...] > In C, the switch statement was explicitly intended to be faster by >

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

2020-06-26 Thread Emily Bowman
On Fri, Jun 26, 2020 at 12:42 AM Rob Cliffe via Python-Dev < python-dev@python.org> wrote: > 1) In the beginning of the "Mapping Pattern" section: > "{" (pattern ":" pattern)+ "}" > This is spelt inconsistently: there is a `+` before the closing `}` > but not after the opening

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

2020-06-26 Thread Emily Bowman
Whoops, meant to reply to Gregory on that one, sorry Richard. On Thu, Jun 25, 2020 at 7:15 PM Gregory P. Smith wrote: > > Can I use an i18n'd _("string") within a case without jumping through > hoops to assign it to a name before the match:? > The PEP currently says: > > "The named class

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

2020-06-25 Thread Emily Bowman
On Thu, Jun 25, 2020 at 8:31 PM Richard Damon wrote: > > I thought _ was also commonly used as: > > first, -, last = (1, 2, 3) > > as a generic don't care about assignment. I guess since the above will > create a local, so not overwrite a 'global' function _ for translations, > so the above

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

2020-06-25 Thread Emily Bowman
On Thu, Jun 25, 2020 at 3:41 PM Richard Damon wrote: > Actually, you could make _ less special by still binding the value to > it, just make it special in that you allow several values to be bound, > and maybe just define that the result will be just one of the values, > maybe even specify which

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

2020-06-25 Thread Emily Bowman
On Wed, Jun 24, 2020 at 12:46 PM Guido van Rossum wrote: > Everyone, > > If you've commented and you're worried you haven't been heard, please add > your issue *concisely* to this new thread. Note that the following issues > are already open and will be responded to separately; please don't

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

2020-06-25 Thread Emily Bowman
On Thu, Jun 25, 2020 at 9:21 AM Rhodri James wrote: > Well, now is the time for expressing surprise :-p > > As I've said before, one of my main problems with the PEP is as you go > through it, more and more special cases and surprises appear, and the > consequences of earlier surprises generate

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

2020-06-24 Thread Emily Bowman
On Wed, Jun 24, 2020 at 3:15 PM Ethan Furman 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 the > PEP. > > >

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

2020-06-24 Thread Emily Bowman
On Tue, Jun 23, 2020 at 10:59 PM Rob Cliffe via Python-Dev < python-dev@python.org> wrote: > > >> I also (with others) prefer `else:` or perhaps `case else:` to using > >> the`_` variable. > >> The latter is obscure, and woudn't sit well with code that already > >> uses that variable for its own

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

2020-06-23 Thread Emily Bowman
On Tue, Jun 23, 2020 at 2:10 PM MRAB wrote: > I think that's done for consistency. '_' is a wildcard and you can have: > > case (_, _): > > to match any 2-tuple, so: > > case _: > > would match any value, and can thus already serve as the default. > > I wouldn't object to 'else',

[Python-Dev] Re: os.add_dll_directory and DLL search order

2020-06-22 Thread Emily Bowman
It's still a problem, even if it's a problem in the opposite direction than you first thought (Python has a newer sqlite, rather than older). Updating your API fixes the problem now, but you still need to decide how you check for and handle newer, potentially incompatible library versions. On

[Python-Dev] Re: Should we be making so many changes in pursuit of PEP 554?

2020-06-17 Thread Emily Bowman
On Wed, Jun 17, 2020 at 5:56 AM Nick Coghlan wrote: > > Doing full blown zero-copy ownership transfer of actual Python objects > would be more difficult, since the current plan is to have separate memory > allocation pools per interpreter to avoid excessive locking overhead, so I > don't

[Python-Dev] Re: How to specify optional support of arguments

2020-06-15 Thread Emily Bowman
Isn't it more Pythonic to simply call the function and an alternative path to handle the exception, anyway? Half of os needs to be tested for NotImplementedError or OSError if it's going to run anywhere outside the development environment anyway, otherwise you're stuck with only the most basic

[Python-Dev] Re: My take on multiple interpreters (Was: Should we be making so many changes in pursuit of PEP 554?)

2020-06-12 Thread Emily Bowman
On Fri, Jun 12, 2020 at 7:19 AM Mark Shannon wrote: > Hi Edwin, > > Thanks for providing some concrete numbers. > Is it expected that creating 100 processes takes 6.3ms per process, but > that creating 1000 process takes 40ms per process? That's over 6 times > as long in the latter case. > >

[Python-Dev] Re: My take on multiple interpreters (Was: Should we be making so many changes in pursuit of PEP 554?)

2020-06-10 Thread Emily Bowman
On Wed, Jun 10, 2020 at 5:37 AM Mark Shannon wrote: > By sharing an address space the separation is maintained by trust and hoping that third party modules don't have too many bugs. By definition, the use of any third-party module (or even the standard library itself) is by trust and the hope

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

2020-05-20 Thread Emily Bowman
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.) I think this is *more* of a zip_shortest than zip_strict, but since you can never have total clarity without a method name that

[Python-Dev] Re: PoC: Subinterpreters 4x faster than sequential execution or threads on CPU-bound workaround

2020-05-07 Thread Emily Bowman
On Wed, May 6, 2020 at 12:36 PM Nathaniel Smith wrote: > > Sure, zero cost is always better than some cost, I'm not denying that > :-). What I'm trying to understand is whether the difference is > meaningful enough to justify subinterpreters' increased complexity, > fragility, and ecosystem

[Python-Dev] Re: PoC: Subinterpreters 4x faster than sequential execution or threads on CPU-bound workaround

2020-05-06 Thread Emily Bowman
Main memory bus or cache contention? Integer execution ports full? Throttling? VTune is useful to find out where the bottleneck is, things like that tend to happen when you start loading every logical core. On Tue, May 5, 2020 at 4:45 PM Joseph Jenne via Python-Dev < python-dev@python.org>

[Python-Dev] Re: For-If syntax

2020-05-04 Thread Emily Bowman
Thanks, this is what I was looking for and couldn't find. I'm glad it is something that's been considered and debated before. I'm not sure why I couldn't find it or anything like it, but I guess the syntax is just a needle in a haystack. Em On Sat, May 2, 2020 at 7:42 AM Henk-Jaap Wagenaar <

[Python-Dev] For-If syntax

2020-05-01 Thread Emily Bowman
I hope this isn't too noobish, nothing on the list comes up in Google, but I'm curious why the construct for x in y if x.is_some_thing: # do a thing isn't legal. That seems a very Pythonic symmetry with lambdas. The equivalent syntax required right now is, for x in [x for x in y if