[Python-Dev] Re: Request for comments on final version of PEP 653 (Precise Semantics for Pattern Matching)

2021-03-31 Thread Chris Angelico
On Thu, Apr 1, 2021 at 11:54 AM Caleb Donovick wrote: > > > Here, `Child` will *not* match as a sequence, even though it probably > > should, > > Strong disagree, if I explicitly set `__match_seq__` to `False` in `Parent` > I probably have a good reason for it and would absolutely expect

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

2021-03-10 Thread Chris Angelico
On Thu, Mar 11, 2021 at 12:16 AM Evpok Padding wrote: > > Dear all, > > Apparently renaming a git branch to follow the general convention is now an > unbearable outrage. It is NOT a general convention. It is a push by Microsoft (owners of GitHub). Outside of GitHub, the git command still uses

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

2021-03-10 Thread Chris Angelico
On Thu, Mar 11, 2021 at 2:48 AM Charalampos Stratakis wrote: > > > > - Original Message - > > From: "Chris Angelico" > > To: "Python-Dev" > > Sent: Wednesday, March 10, 2021 4:20:19 PM > > Subject: [Python-Dev] Re: Steering Counci

[Python-Dev] Re: aiter/anext review request

2021-03-20 Thread Chris Angelico
On Sun, Mar 21, 2021 at 1:30 PM Yury Selivanov wrote: > That said I wouldn't mind aiter() supporting the two-arguments mode as it > could make it easier to convert some sync code bases (that use greenlets, for > example) to async. And given that async iteration mirrors the sync iteration >

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

2021-03-09 Thread Chris Angelico
On Wed, Mar 10, 2021 at 12:09 PM Ivan Pozdeev via Python-Dev wrote: > > > On 10.03.2021 3:53, Chris Angelico wrote: > > On Wed, Mar 10, 2021 at 11:47 AM Damian Shaw > > wrote: > >>> Does 'master' confuse people? > >> There's a general movement t

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

2021-03-09 Thread Chris Angelico
On Wed, Mar 10, 2021 at 11:47 AM Damian Shaw wrote: > > > Does 'master' confuse people? > > There's a general movement to replace language from common programming > practises that derive from, or are associated with, the dehumanization of > people. Such as master and slave, as well as whitelist

[Python-Dev] Re: Typing syntax and ecosystem, take 2

2021-04-14 Thread Chris Angelico
On Thu, Apr 15, 2021 at 2:36 PM Hugh Fisher wrote: > > > Date: Wed, 14 Apr 2021 09:57:49 +1000 > > From: Chris Angelico > > Subject: [Python-Dev] Re: Typing syntax and ecosystem, take 2 > > > > > You're advocating an approach that absolutely mandates running t

[Python-Dev] Re: Typing syntax and ecosystem, take 2

2021-04-13 Thread Chris Angelico
On Wed, Apr 14, 2021 at 9:45 AM Hugh Fisher wrote: > I don't want Python to be explicitly typed either. I'm happy with dynamic > typing, and do not want to have to write even > x : object You don't. That's not the proposal. The proposals have ALL been about gradual typing and inferred

[Python-Dev] Re: Typing syntax and ecosystem, take 2

2021-04-13 Thread Chris Angelico
On Wed, Apr 14, 2021 at 9:47 AM Hugh Fisher wrote: > > > From: Ned Batchelder > [ munch ] > > This is very similar to statically typed languages. They also have two > > steps: > > > > * There is the first step that checks the types but does not run the > > program. In C/C++, this is the

[Python-Dev] Re: How about using modern C++ in development of CPython ?

2021-04-20 Thread Chris Angelico
On Wed, Apr 21, 2021 at 1:05 AM Skip Montanaro wrote: >> >> Perhaps there's some history in the python-dev archives that would inform >> you of previous discussions and help you repeating already-considered >> arguments. > > > This topic has come up a few times over the years. Maybe it would be

[Python-Dev] Re: Keeping Python a Duck Typed Language.

2021-04-20 Thread Chris Angelico
On Wed, Apr 21, 2021 at 3:04 AM Mark Shannon wrote: > Then came type hints. PEP 484 explicitly said that type hints were > optional and would *always* be optional. > > Then came along many typing PEPs that assumed that type hints would only > used for static typing, making static typing a bit

[Python-Dev] Re: How about using modern C++ in development of CPython ?

2021-04-16 Thread Chris Angelico
On Sat, Apr 17, 2021 at 3:20 AM wrote: > > The benefits: > > 1. You will link with high quality libstdc++ with lots of reusable containers > without writing your own "buggy" one. > 2. C++ is much much more maintainable than pure C. It drastically increase > number of contributors that what like

[Python-Dev] Re: How about using modern C++ in development of CPython ?

2021-04-16 Thread Chris Angelico
On Sat, Apr 17, 2021 at 3:32 AM wrote: > > Chris Angelico wrote: > > On Sat, Apr 17, 2021 at 3:20 AM redrad...@gmail.com wrote: > > > The benefits: > > > > > > You will link with high quality libstdc++ with lots of reusable > > > containers without

[Python-Dev] Re: Concerns about PEP 634

2021-02-06 Thread Chris Angelico
On Sun, Feb 7, 2021 at 8:14 AM Luciano Ramalho wrote: > > On Sat, Feb 6, 2021 at 6:04 PM Steve Holden wrote: > > > > My suggestion that it be introduced via __future__ due to its contentious > > nature met immediate resistance. No point going down that road. > > This is really unfortunate. > >

[Python-Dev] Re: Concerns about PEP 634

2021-02-07 Thread Chris Angelico
On Sun, Feb 7, 2021 at 6:25 PM Paul Sokolovsky wrote: > > Hello, > > On Sat, 6 Feb 2021 23:05:19 -0800 > Guido van Rossum wrote: > > > That’s incorrect. __future__ is used when something new and > > *incompatible* is being introduced (and the old way is being > > deprecated at the same time).

[Python-Dev] Re: Concerns about PEP 634

2021-02-07 Thread Chris Angelico
On Sun, Feb 7, 2021 at 7:54 PM Paul Sokolovsky wrote: > > So, you're saying that, by the benevolence of divine providence, > most (can you truly vouch for "all" and provide evidence?) features so > far added to __future__ never were changed (enough). No, I'm saying that the __future__ directive

[Python-Dev] Re: Python standardization

2021-02-12 Thread Chris Angelico
On Sat, Feb 13, 2021 at 6:58 AM Dan Stromberg wrote: > I believe Python needs to become more independent of CPython, for Python's > long term health. > Since 1997, Python has been defined independently of CPython. There are numerous documents that define the language semantics for the benefit

[Python-Dev] Re: Python standardization

2021-02-12 Thread Chris Angelico
On Sat, Feb 13, 2021 at 10:42 AM Dan Stromberg wrote: > > > On Fri, Feb 12, 2021 at 2:26 PM Chris Angelico wrote: >> >> On Sat, Feb 13, 2021 at 6:58 AM Dan Stromberg wrote: >> > I believe Python needs to become more independent of CPython, for Python's >>

[Python-Dev] Re: Python standardization

2021-02-13 Thread Chris Angelico
On Sun, Feb 14, 2021 at 7:38 AM Wes Turner wrote: > > https://awesome-safety-critical.readthedocs.io/en/latest/ > https://awesome-safety-critical.readthedocs.io/en/latest/#software-safety-standards > > What is and is not constant time in Python could be added to structured data > elements in

[Python-Dev] Re: Keeping Python a Duck Typed Language.

2021-04-22 Thread Chris Angelico
On Fri, Apr 23, 2021 at 11:22 AM Larry Hastings wrote: > > > On 4/20/21 10:03 AM, Mark Shannon wrote: > > If you guarded your code with `isinstance(foo, Sequence)` then I could not > use it with my `Foo` even if my `Foo` quacked like a sequence. I was forced > to use nominal typing; inheriting

[Python-Dev] Re: PEP 654: Exception Groups and except* [REPOST]

2021-04-23 Thread Chris Angelico
On Fri, Apr 23, 2021 at 6:25 PM Nathaniel Smith wrote: > > On Wed, Apr 21, 2021 at 4:50 PM Guido van Rossum wrote: > > On Wed, Apr 21, 2021 at 3:26 PM Nathaniel Smith wrote: > >> Sure. This was in my list of reasons why the backwards compatibility > >> tradeoffs are forcing us into awkward

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

2021-08-15 Thread Chris Angelico
On Mon, Aug 16, 2021 at 12:24 AM Marco Sulla wrote: > > On Thu, 12 Aug 2021 at 12:54, Steven D'Aprano wrote: > > Are you looking for upvotes on StackOverflow > > This is unacceptable. I pretend your immediate excuses. > ? I don't understand this, what do you mean? ChrisA

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

2021-08-15 Thread Chris Angelico
On Mon, Aug 16, 2021 at 6:36 AM Marco Sulla wrote: > > As Chris implied, the second 'sentence' is not grammatical English > > Oh, this is enough. The sense of the phrase was very clear and you all > have understood it. Remarking grammatical errors is a gross violation > of the Netiquette. I ask

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

2021-08-15 Thread Chris Angelico
On Mon, Aug 16, 2021 at 7:56 AM 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

[Python-Dev] Re: Notes on PEP 8

2021-08-26 Thread Chris Angelico
On Fri, Aug 27, 2021 at 3:02 AM Skip Montanaro wrote: >> >> However, it has become a de facto standard for all Python code, and in the >> document itself, there is frequent wording akin to "Identifiers used in the >> standard library must be ASCII compatible ...", and even advice for third >>

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

2021-08-16 Thread Chris Angelico
On Mon, Aug 16, 2021 at 5:44 PM Federico Salerno wrote: > > "Pretendere" in Italian means "to demand", it's a false friend with the > English "pretend". I don't know whether Marco is Italian (the false > friend might also be there between Spanish or whatever other romance > language he speaks and

[Python-Dev] Re: Dropping out of this list

2021-08-19 Thread Chris Angelico
On Thu, Aug 19, 2021 at 12:42 PM Jonathan Goble wrote: > > On Wed, Aug 18, 2021 at 10:22 PM Terry Reedy wrote: >> >> On 8/18/2021 9:37 PM, Edwin Zimmerman wrote: >> > On 8/18/21 9:18 PM, Jonathan Goble wrote: >> >> I am mostly a lurker, but I am also considering unsubscribing if someone >> >>

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

2021-09-08 Thread Chris Angelico
On Wed, Sep 8, 2021 at 10:42 PM 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

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-11 Thread Chris Angelico
On Wed, Aug 11, 2021 at 10:03 PM Larry Hastings wrote: > Specifically: currently, decorators are called just after the function or > class object is created, before it's bound to a variable. But we could > change it so that we first bind the variable to the initial value, then call > the

[Python-Dev] Re: PEP 649: Deferred Evaluation Of Annotations

2021-08-11 Thread Chris Angelico
On Thu, Aug 12, 2021 at 3:01 AM Larry Hastings wrote: > > On 8/11/21 5:15 AM, Chris Angelico wrote: > > On Wed, Aug 11, 2021 at 10:03 PM Larry Hastings wrote: > > This approach shouldn't break reasonable existing code. That said, this > change would be observable from Pyt

[Python-Dev] Re: Python multithreading without the GIL

2021-10-07 Thread Chris Angelico
On Fri, Oct 8, 2021 at 1:51 PM Sam Gross wrote: > > Hi, > > I've been working on changes to CPython to allow it to run without the global > interpreter lock. I'd like to share a working proof-of-concept that can run > without the GIL. The proof-of-concept involves substantial changes to CPython

[Python-Dev] Re: RFC on Callable Type Syntax

2021-10-07 Thread Chris Angelico
On Fri, Oct 8, 2021 at 1:45 PM S Pradeep Kumar wrote: > The Callable type is also usable as an expression, like in type aliases > `IntOperator = (int, int) -> int` and `cast((int) -> int, f)` calls. > > **Question 1**: Are there concerns we should keep in mind about such a syntax > proposal? >

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Chris Angelico
On Thu, Oct 14, 2021 at 10:51 AM Victor Stinner wrote: > > Honestly, I don't understand well the difference between __int__() and > __index__(). > > * https://docs.python.org/dev/reference/datamodel.html#object.__int__ > * https://docs.python.org/dev/reference/datamodel.html#object.__index__

[Python-Dev] Re: Python multithreading without the GIL

2021-10-09 Thread Chris Angelico
On Sun, Oct 10, 2021 at 2:31 PM Dan Stromberg wrote: > > > On Thu, Oct 7, 2021 at 9:10 PM Chris Angelico wrote: >> >> Concurrency is *hard*. There's no getting around it, there's no >> sugar-coating it. There are concepts that simply have to be learned, >> and t

[Python-Dev] Re: Semi-proposal: Tagged None

2021-10-21 Thread Chris Angelico
On Fri, Oct 22, 2021 at 3:23 AM David Mertz, Ph.D. wrote: > > On Thu, Oct 21, 2021 at 2:52 AM Steven D'Aprano wrote: >> >> On Tue, Oct 19, 2021 at 05:09:42PM -0700, Michael Selik wrote: >> > None and its ilk often conflate too many qualities. For example, is it >> > missing because it doesn't

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-19 Thread Chris Angelico
On Wed, Oct 20, 2021 at 3:25 AM Baptiste Carvello wrote: > > Le 18/10/2021 à 20:26, Guido van Rossum a écrit : > > > > y = None # Default > > if config is not None: > > handler = config.get("handler") > > if handler is not None: > > parameters = handler.get("parameters") > > if

[Python-Dev] Re: The Default for python -X frozen_modules.

2021-09-27 Thread Chris Angelico
On Tue, Sep 28, 2021 at 3:21 AM Eric Snow wrote: > > On Mon, Sep 27, 2021 at 11:09 AM Chris Angelico wrote: > > When exactly does the freezing happen? > > When you build the executable (e.g. "make -j8", > ".\PCbuild\build.bat"). So your changes to

[Python-Dev] Re: The Default for python -X frozen_modules.

2021-09-27 Thread Chris Angelico
On Tue, Sep 28, 2021 at 2:58 AM Eric Snow wrote: > > We've frozen most of the stdlib modules imported during "python -c > pass" [1][2], to make startup a bit faster. Import of those modules > is controlled by "-X frozen_modules=[on|off]". Currently it defaults > to "off" but we'd like to

[Python-Dev] Re: Function Prototypes

2021-12-23 Thread Chris Angelico
On Fri, Dec 24, 2021 at 1:36 PM Steven D'Aprano wrote: > > My question is, why does it need `@Callable`? Lukasz proposed just using > > any (undecorated) function, with the convention being that the body is > > `...` (to which I would add the convention that the function *name* be > >

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

2021-11-09 Thread Chris Angelico
On Wed, Nov 10, 2021 at 11:44 AM Ethan Furman wrote: > I don't know if there's a formal name, but in my mind, if you have something > you don't have nothing. If you have a > barrel with nothing in it (not even air, just a hard vacuum) then saying you > have nothing in that barrel is a true >

[Python-Dev] Re: Having Sorted Containers in stdlib?

2021-11-09 Thread Chris Angelico
On Wed, Nov 10, 2021 at 5:45 PM Steven D'Aprano wrote: > > On Wed, Nov 10, 2021 at 05:11:33PM +1100, Chris Angelico wrote: > > > Nothing's technically new. You could make an inefficient sorted dict like > > this: > > > > class SortedDict(dict): > >

[Python-Dev] Re: Having Sorted Containers in stdlib?

2021-11-09 Thread Chris Angelico
On Wed, Nov 10, 2021 at 5:03 PM Christopher Barker wrote: > > Maybe a stupid question: > > What are use cases for sorted dicts? > > I don’t think I’ve ever needed one. Me neither, tbh. > Also, I can’t quite tell from the discussion If a “sorted dict” implements > something new, or is an

[Python-Dev] Re: Having Sorted Containers in stdlib?

2021-11-12 Thread Chris Angelico
On Sat, Nov 13, 2021 at 3:20 AM Steven D'Aprano wrote: > > On Fri, Nov 12, 2021 at 10:07:13AM -0500, Paul Ganssle wrote: > > > I knew about sortedcontainers and I also don't remember ever seeing a > > situation where I needed one or recommended its use. > > We have a very odd situation where

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

2021-11-15 Thread Chris Angelico
On Tue, Nov 16, 2021 at 12:13 PM Steven D'Aprano wrote: > > On Mon, Nov 15, 2021 at 10:43:12PM +1100, Chris Angelico wrote: > > > The problems here are not Python's, they are code reviewers', and that > > means they're really attacks against the code review tools. > >

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

2021-11-28 Thread Chris Angelico
On Mon, Nov 29, 2021 at 10:11 AM Rob Cliffe via Python-Dev wrote: > > I am slightly surprised that it seems to be *easier* to fold selected > constant expressions than to have more generic code to fold them all. > Or at least, all those that don't contain containers, such as > 1 in [0,1,2]

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

2021-11-15 Thread Chris Angelico
On Mon, Nov 15, 2021 at 10:22 PM Abdur-Rahmaan Janhangeer wrote: > > Greetings, > > > > Now what happens? where do you go from there to a vunerability or > backdoor? I think it might be a bit obvious that there is something > funny going on if I see: > > if (user.admin == "root" and

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-02 Thread Chris Angelico
On Wed, Nov 3, 2021 at 1:06 AM Petr Viktorin wrote: > Let me know if it's clear in the newest version, with this note: > > > Here, ``encoding: unicode_escape`` in the initial comment is an encoding > > declaration. The ``unicode_escape`` encoding instructs Python to treat > > ``\u0027`` as a

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-02 Thread Chris Angelico
On Wed, Nov 3, 2021 at 5:07 AM David Mertz, Ph.D. wrote: > > This is an amazing document, Petr. Really great work! > > I think I agree with Marc-André that putting it in the actual Python > documentation would give it more visibility than in a PEP. > There are quite a few other PEPs that have

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-02 Thread Chris Angelico
On Wed, Nov 3, 2021 at 11:09 AM Steven D'Aprano wrote: > > On Wed, Nov 03, 2021 at 03:03:54AM +1100, Chris Angelico wrote: > > On Wed, Nov 3, 2021 at 1:06 AM Petr Viktorin wrote: > > > Let me know if it's clear in the newest version, with this note: > > > > >

[Python-Dev] Naming convention for AST types

2021-10-28 Thread Chris Angelico
As part of messing with the parser for PEP 671, I've come across what looks like a convention, but I'm not sure of the details. Most AST nodes start with a capital letter: Expr, Name, BoolOp, etc. Some don't: keyword, arg, withitem. Is it true that the ones that don't start with a capital are

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-22 Thread Chris Angelico
On Sat, Oct 23, 2021 at 6:20 AM Marc Mueller wrote: > > Most of the discussion so far has been focused on (?.). Tbh though, I'm more > interested in (??) and (??=). Just reading through code, I constantly notice > boilerplate like this which could easily be substituted. > > variable =

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-23 Thread Chris Angelico
On Sun, Oct 24, 2021 at 12:35 AM Marc Mueller wrote: > > > Bear in mind that these last ones are exactly equivalent to the "or" > > operator, as they'll use the default if you have any falsy value. > > variable = some_function(...) or [] > > Isn't that in itself a good argument in favor of (??) ?

[Python-Dev] Re: Proposal: Allow non-default after default arguments

2021-11-09 Thread Chris Angelico
On Tue, Nov 9, 2021 at 8:38 PM Sebastian Rittau wrote: > > Currently, Python doesn't allow non-default arguments after default > arguments: > > >>> def foo(x=None, y): pass >File "", line 1 > def foo(x=None, y): pass > ^ > SyntaxError: non-default argument follows

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-03 Thread Chris Angelico
On Wed, Nov 3, 2021 at 10:22 PM Steven D'Aprano wrote: > > On Wed, Nov 03, 2021 at 11:21:53AM +1100, Chris Angelico wrote: > > > TBH, I'm not entirely sure how valid it is to talk about *security* > > considerations when we're dealing with Python source code and va

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-03 Thread Chris Angelico
On Wed, Nov 3, 2021 at 8:01 PM Stephen J. Turnbull wrote: > > Chris Angelico writes: > > > But I was surprised to find that Python would let you use > > unicode_escape for source code. > > I'm not surprised. Today it's probably not necessary, but I've > excha

[Python-Dev] Re: PEP 467: Minor bytes and bytearray improvements

2021-11-04 Thread Chris Angelico
On Fri, Nov 5, 2021 at 2:59 AM Jonathan Goble wrote: > > On Thu, Nov 4, 2021 at 10:37 AM Eric Fahlgren wrote: >> >> On Thu, Nov 4, 2021 at 12:01 AM Ethan Furman wrote: >>> >>> >>> bytearray.fromsize(5, fill=b'\x0a') >>> bytearray(b'\x0a\x0a\x0a\x0a\x0a') >> >> >> What happens if you

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-03 Thread Chris Angelico
On Wed, Nov 3, 2021 at 5:12 PM Stephen J. Turnbull wrote: > > Chris Angelico writes: > > > Huh. Is that level of generality actually still needed? Can Python > > deprecate all but a small handful of encodings? > > I think that's pointless. With few exceptions (G

[Python-Dev] Re: The current state of typing PEPs

2021-11-30 Thread Chris Angelico
On Tue, Nov 30, 2021 at 8:19 PM Paul Moore wrote: > Also, related to the question Terry raised, IMO it would be useful to > have a clear statement on code that *does* use type annotations, but > violates them at runtime. To be specific, is the following considered > as an error? > > >>> def

[Python-Dev] Re: "immortal" objects and how they would help per-interpreter GIL

2021-12-15 Thread Chris Angelico
On Thu, Dec 16, 2021 at 6:03 AM Eric Snow wrote: > * using the ref count isn't the only viable approach; another would be > checking the pointer itself >+ put the object in a specific section of static data and compare > the pointer against the bounds >+ this avoids loading the actual

[Python-Dev] Re: "immortal" objects and how they would help per-interpreter GIL

2021-12-15 Thread Chris Angelico
On Thu, Dec 16, 2021 at 7:03 AM Eric Snow wrote: > > On Wed, Dec 15, 2021 at 12:18 PM Chris Angelico wrote: > > Sorry if this is a dumb question, but would it be possible to solve > > that last point with an immortal arena [1] from which immortal objects > > could be al

[Python-Dev] Re: Suggestion: a little language for type definitions

2022-01-08 Thread Chris Angelico
On Sun, Jan 9, 2022 at 3:47 PM Steven D'Aprano wrote: > The point I am making here is not that I was a dimwit who couldn't even > read Python, but that "easy to read" and "readable" is more a matter of > familiarity than an inherent property of the language itself. With > enough familiarity, even

[Python-Dev] Re: About vulnerabilities in Cpython native code

2022-01-09 Thread Chris Angelico
On Sun, Jan 9, 2022 at 7:35 PM Stephen J. Turnbull wrote: > > Chris Angelico writes: > > > Not completely, just very minorly. I'm distinguishing between attacks > > that can be triggered remotely, and those which require the attacker > > to run specific Python code

[Python-Dev] Re: Suggestion: a little language for type definitions

2022-01-09 Thread Chris Angelico
On Mon, Jan 10, 2022 at 3:49 AM Christopher Barker wrote: > > If "x->y" is syntactically valid anywhere in Python code, it's not a > problem that there are no core data types for which it's meaningful.) > > Here's where I'm not so sure -- this looks a lot like a binary operator, but > it behaves

[Python-Dev] Re: Suggestion: a little language for type definitions

2022-01-09 Thread Chris Angelico
On Mon, Jan 10, 2022 at 12:05 PM Steven D'Aprano wrote: > > On Mon, Jan 10, 2022 at 05:39:42AM +1100, Chris Angelico wrote: > > > From my understanding, "x->y" would create a Callable if given two > > *types*, but its meaning if given two other objects is still &

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Chris Angelico
On Fri, Jan 14, 2022 at 2:12 AM Steven Troxler wrote: > > Using an operator is an interesting idea, and we should probably call it out > as an alternative in the PEP. > It's not a substitute for the current PEP from the standpoint of typing-sig > for a few reasons: > > (A) We care that the

[Python-Dev] Re: About vulnerabilities in Cpython native code

2022-01-07 Thread Chris Angelico
On Fri, Jan 7, 2022 at 6:09 PM Stephen J. Turnbull wrote: > > Chris Angelico writes: > > > Python source code is not user input though. So there has to be a way > > for someone to attack a Python-based service, like attacking a web app > > by sending HTTP requests to

[Python-Dev] Re: PEP 683: "Immortal Objects, Using a Fixed Refcount"

2022-02-21 Thread Chris Angelico
On Tue, 22 Feb 2022 at 03:00, Larry Hastings wrote: > > > On 2/21/22 22:06, Chris Angelico wrote: > > On Mon, 21 Feb 2022 at 16:47, Larry Hastings wrote: > > While I don't think it's fine to play devil's advocate, given the choice > between "this will help a com

[Python-Dev] Re: PEP 683: "Immortal Objects, Using a Fixed Refcount"

2022-02-20 Thread Chris Angelico
On Mon, 21 Feb 2022 at 16:47, Larry Hastings wrote: > > > While I don't think it's fine to play devil's advocate, given the choice > between "this will help a common production use-case" (pre-fork servers) and > "this could hurt a hypothetical production use case" (long-running > applications

[Python-Dev] Re: C API: Move PEP 523 "Adding a frame evaluation API to CPython" private C API to the internal C API

2022-04-01 Thread Chris Angelico
On Fri, 1 Apr 2022 at 19:51, Victor Stinner wrote: > In Python, sadly the types.CodeType type also has a public constructor > and many projects break at each Python release because the API > changes. Hopefully, it seems like the new CodeType.replace() method > added to Python 3.8 mitigated the

[Python-Dev] Re: walrus operator and expression

2022-03-28 Thread Chris Angelico
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 = binascii.b2a_base64(s) >

[Python-Dev] Re: It's now time to deprecate the stdlib urllib module

2022-02-08 Thread Chris Angelico
On Wed, 9 Feb 2022 at 04:50, Christopher Barker wrote: > So my thoughts: > > Rather than deprecate urllib, we refactor it a bit (and maybe deprecate parts > of it), so that it: > > 1) contains the core building blocks: e.g. urllib.parse with which to build > "better" libraries, > > 2) make the

[Python-Dev] Re: About vulnerabilities in Cpython native code

2022-01-06 Thread Chris Angelico
On Fri, Jan 7, 2022 at 1:59 AM lxr1210--- via Python-Dev wrote: > > Hi all, > > I am currently doing some research on the security of CPython. I used the > open source vulnerability analysis engine, Infer(https://fbinfer.com/), to > scan the native code of CPython 3.10.0. > > The scan results

[Python-Dev] Re: About vulnerabilities in Cpython native code

2022-01-06 Thread Chris Angelico
On Fri, Jan 7, 2022 at 2:57 PM Stephen J. Turnbull wrote: > > Patrick Reader writes: > > > And Python is not like JavaScript (in the browser), where code is > > supposed to be run in a total sandbox. Python is not supposed to be a > > completely memory-safe language. You can always access

[Python-Dev] Re: Declarative imports

2022-04-08 Thread Chris Angelico
On Fri, 8 Apr 2022 at 18:29, Malthe wrote: > > This is an idea which has been brought up before, sometimes introduced > as "heresy". But an interesting twist has surfaced now which is > typing. > > But firstly, let me present the idea. It is very simple, that Python > should have declarative

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-22 Thread Chris Angelico
On Sat, 23 Apr 2022 at 11:16, Larry Hastings wrote: > This PEP proposes an additional syntax for declaring a class which splits > this work across two statements: > * The first statement is `forward class`, which declares the class and binds >the class object. > * The second statement is

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-26 Thread Chris Angelico
On Tue, 26 Apr 2022 at 22:56, Greg Ewing wrote: > > On 26/04/22 12:33 pm, Chris Angelico wrote: > > That's exactly what I mean though: if the only difference between > > "monkeypatching" and "not monkeypatching" is whether it was intended, > &g

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-25 Thread Chris Angelico
On Tue, 26 Apr 2022 at 10:05, Greg Ewing wrote: > > On 23/04/22 5:44 pm, Chris Angelico wrote: > > On Sat, 23 Apr 2022 at 15:32, Larry Hastings wrote: > >> > >> Still, it's not the intent of my PEP to condone or facilitate > >> monkeypatching. > >&

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-27 Thread Chris Angelico
On Wed, 27 Apr 2022 at 16:04, Greg Ewing wrote: > > On 27/04/22 1:26 pm, Chris Angelico wrote: > > On Wed, 27 Apr 2022 at 11:18, Greg Ewing > > wrote: > >> > >> The proposed feature is analogous to forward declaring a > >> struct in

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-26 Thread Chris Angelico
On Wed, 27 Apr 2022 at 08:06, Greg Ewing wrote: > > On 27/04/22 1:04 am, Joao S. O. Bueno wrote: > > MonkeyPatching in Python is not illegal in this sense. > > I'm not suggesting it is. You're seizing on the wrong part > of the analogy. The point is that what you call something > doesn't change

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-26 Thread Chris Angelico
On Wed, 27 Apr 2022 at 11:18, Greg Ewing wrote: > > On 27/04/22 2:01 am, Chris Angelico wrote: > > That would be the case if monkeypatching were illegal. Since it's not, > > wherein lies the difference? > > The proposed feature is analogous to forward declaring a >

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

2022-04-26 Thread Chris Angelico
On Wed, 27 Apr 2022 at 05:05, Larry Hastings wrote: > > > On 4/26/22 09:31, MRAB wrote: >> Perhaps: >> >>class C: ... > > Also, your suggestion is already legal Python syntax; it creates a class with > no attributes. So changing this existing statement to mean something else > would

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-22 Thread Chris Angelico
On Sat, 23 Apr 2022 at 12:50, Larry Hastings wrote: > > > On 4/22/22 19:17, Chris Angelico wrote: > > I'm unsure about the forward class. How is it different from subclassing an > ABC? > > They're just different objects. A subclass of an ABC is either itself >

[Python-Dev] Re: Proto-PEP part 1: Forward declaration of classes

2022-04-22 Thread Chris Angelico
On Sat, 23 Apr 2022 at 15:32, Larry Hastings wrote: > > > On 4/22/22 22:03, Chris Angelico wrote: > > Anyhow, [a forward-defined class object is] a class, with some special > features (notably that you can't instantiate it). > > Yes. Specifically, here's my intention fo

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

2022-05-28 Thread Chris Angelico
On Sun, 29 May 2022 at 05:05, MRAB wrote: > > 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

[Python-Dev] Re: Switching to Discourse

2022-07-21 Thread Chris Angelico
On Fri, 22 Jul 2022 at 03:07, Skip Montanaro wrote: > > I have a perhaps stupid question. Is Discord the same as > discuss.python.org, just by another name? I find the similarity in > names a bit confusing. > No, Discord is a different thing; it does text and voice communication channels in

[Python-Dev] Re: Switching to Discourse

2022-07-21 Thread Chris Angelico
On Fri, 22 Jul 2022 at 03:17, Skip Montanaro wrote: > > > No, Discord is a different thing; it does text and voice communication > > channels in real-time. If you're familiar with Slack, it's broadly > > similar in purpose. > > Thanks (and to the others who replied). It seems like they've tried

[Python-Dev] Re: A proposal to modify `None` so that it hashes to a constant

2022-12-04 Thread Chris Angelico
On Mon, 5 Dec 2022 at 05:11, Rob Cliffe via Python-Dev wrote: > > Wild suggestion: > Make None.__hash__ writable. > E.g. > None.__hash__ = lambda : 0 # Currently raises AttributeError: > 'NoneType' object attribute '__hash__' is read-only Hashes have to be stable. If you change the

[Python-Dev] Re: A proposal to modify `None` so that it hashes to a constant

2022-11-28 Thread Chris Angelico
On Tue, 29 Nov 2022 at 09:51, Brett Cannon wrote: > ... we worked hard to stop people from relying on consistent > hashing/iteration from random-access data structures like dict and set. > Say what? Who's been working hard to stop people from relying on consistent iteration order for a dict?

[Python-Dev] Re: A proposal to modify `None` so that it hashes to a constant

2022-11-28 Thread Chris Angelico
On Tue, 29 Nov 2022 at 13:12, Oscar Benjamin wrote: > As for point 2. the fact that sets are currently non-deterministic is > actually a relatively new thing in Python. Before hash-randomisation > set and dict order *was* deterministic but with an arbitrary order. > That was only changed because

[Python-Dev] Re: A proposal to modify `None` so that it hashes to a constant

2022-11-29 Thread Chris Angelico
On Wed, 30 Nov 2022 at 10:48, Steven D'Aprano wrote: > Let's consider a thought-experiment: suppose we agree to your proposal > to make hash(None) return a constant, but at the same time modify the > set iteration algorithm so that it starts from a different position each > time you iterate,

[Python-Dev] Re: A proposal to modify `None` so that it hashes to a constant

2022-11-30 Thread Chris Angelico
On Thu, 1 Dec 2022 at 17:26, Yoni Lavi wrote: > > > the language makes no guarantee about hash consistency between > executions > > because it's futile in the general case, even if objects were to get a serial > `id` and hash by it for example, any change in the number of objects created >

[Python-Dev] Re: Feature Suggestion: "repeat" statement in loops

2023-01-26 Thread Chris Angelico
On Fri, 27 Jan 2023 at 06:42, Thomas Ratzke wrote: > > Hi all, > > i would like to suggest the following Python feature. It naturally > happens that one want's to repeat the current iteration of a for loop > for example after an error happened. For this purpose, I usually set a > flag and put a

<    5   6   7   8   9   10