[Python-Dev] Re: my plans for subinterpreters (and a per-interpreter GIL)

2021-12-15 Thread Guido van Rossum
p.m., Guido van Rossum wrote: > > But as long as the imbalance is less than 0x_2000_, the refcount will > remain in the inclusive range [ 0x_4000_ , 0x_7FFF_ ] and we can > test for immortality by testing a single bit: > > if (o->ob_refcnt & 0x_4000_) > >

[Python-Dev] Re: my plans for subinterpreters (and a per-interpreter GIL)

2021-12-15 Thread Guido van Rossum
objects that we plan to immortalize are all widely shared -- who cares if the refcount for None is 5000 or 1610612736? As long as the refcount of *mortal* objects is the same as it was before, this shouldn't be a problem. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pro

[Python-Dev] Sad news from Zurich

2021-12-10 Thread Guido van Rossum
days. I enjoyed his sense of humor as well. I'm sad that he passed away." We will miss him. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>

[Python-Dev] Re: Explicit markers for special C-API situations (re: Clarification regarding Stable ABI and _Py_*)

2021-12-09 Thread Guido van Rossum
ves. > > [3] The addition of Include/cpython and Include/internal helped us > > stop accidentally adding to the limited API. > > [4] It also makes the groupings deterministically discoverable by tools. > > [5] explicit use of "extern" indicate

[Python-Dev] Re: PEP 674: Disallow using macros as l-value

2021-12-07 Thread Guido van Rossum
; Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/UFPN4VUV3Y4ZV4TYJA

[Python-Dev] Re: PEP 674: Disallow using macros as l-value

2021-12-07 Thread Guido van Rossum
it can even begin testing). > Yeah, this sounds like a good approach *for things where the alternative is never to fix it*. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-ch

[Python-Dev] Re: Clarification regarding Stable ABI and _Py_*

2021-12-07 Thread Guido van Rossum
On Tue, Dec 7, 2021 at 11:02 AM Christian Heimes wrote: > On 07/12/2021 19.28, Guido van Rossum wrote: > > I assume it would be insensitive to ask whether we could just get rid of > > the stable ABI altogether and focus on the limited API? Just tell > > everyone they h

[Python-Dev] Re: PEP 674: Disallow using macros as l-value

2021-12-07 Thread Guido van Rossum
eir dependencies to solve the issue first before they can even start testing, and so on. (For example, many libraries still don't have wheels for Python 3.10, even though it was released over two months ago and 3.10.1 is already out.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(

[Python-Dev] Re: Clarification regarding Stable ABI and _Py_*

2021-12-07 Thread Guido van Rossum
On Tue, Dec 7, 2021 at 12:58 AM Petr Viktorin wrote: > On 06. 12. 21 21:50, Guido van Rossum wrote: > > On Mon, Dec 6, 2021 at 12:12 PM Petr Viktorin > <mailto:encu...@gmail.com>> wrote: > > > > On 06. 12. 21 20:29, Guido van Rossum wrote: > >

[Python-Dev] Re: Clarification regarding Stable ABI and _Py_*

2021-12-06 Thread Guido van Rossum
On Mon, Dec 6, 2021 at 12:12 PM Petr Viktorin wrote: > On 06. 12. 21 20:29, Guido van Rossum wrote: > > Hi Petr, > > > > In PEP 384 it is written that no functions starting with an underscore > > are part of the stable ABI: > > > > PEP 384 -- Defini

[Python-Dev] Clarification regarding Stable ABI and _Py_*

2021-12-06 Thread Guido van Rossum
just out of date? Or how can the discrepancy be explained? -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___ Pyt

[Python-Dev] Re: Expectations of typing (was: The current state of typing PEPs)

2021-11-30 Thread Guido van Rossum
On Tue, Nov 30, 2021 at 4:48 PM Oscar Benjamin wrote: > On Tue, 30 Nov 2021 at 23:37, Guido van Rossum wrote: > > > > We should definitely push back on zealous new converts to typing who > insist that everything should be annotated. But we should also recognize > that even

[Python-Dev] Re: Expectations of typing (was: The current state of typing PEPs)

2021-11-30 Thread Guido van Rossum
emendous value from typing stubs, in the form of improved auto-complete and hover-doc functionality.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>

[Python-Dev] Re: PEP 674: Disallow using macros as l-value

2021-11-30 Thread Guido van Rossum
Victor Stinner > * `[C API] Disallow using PyFloat_AS_DOUBLE() as l-value > <https://bugs.python.org/issue45476>`_ > (October 2021) > * `[capi-sig] Py_TYPE() and Py_SIZE() become static inline functions > < > https://mail.python.org/archives/l

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

2021-11-29 Thread Guido van Rossum
vior and running a static checker is a choice, like running a linter. Three-space indents or capitalized function names are never going to be disallowed either, even though PEP 8 says that's not how you ought to code.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronou

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

2021-11-26 Thread Guido van Rossum
Fri, Nov 26, 2021 at 1:47 PM Guido van Rossum wrote > > It's easy enough to do something at runtime with `def f(a: list[int]) > -> int`. It's not so simple to handle `def f(a: Sequence[T]) -> T` or `def > f(cb: (T) -> tuple[str, T], Sequence[T]) -> Mapping[str, T]`. Pres

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

2021-11-26 Thread Guido van Rossum
On Fri, Nov 26, 2021 at 11:58 AM Paul Moore wrote: > On Fri, 26 Nov 2021 at 17:13, Guido van Rossum wrote: > > >> Although the more I think about it, given that I believe dataclasses > >> use eval "under the hood", the less I understand *how* it manages to

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

2021-11-26 Thread Guido van Rossum
I'd like to see a clearer statement from "somewhere" about how APIs > should use annotations at runtime, such that Python users have a much > clearer intuition about APIs like the dataclass one, and library > designers can build their APIs based on a clear "common understanding&q

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

2021-11-25 Thread Guido van Rossum
to be a big use case, hence the mistaken belief at the time PEP 563 was accepted that stringifying annotations would be sufficient for the introspection use case. So I'm in agreement with Stephen, but since he left out any mention of offline static checking, his observation isn't helping much.

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Guido van Rossum
Brandt looked at coz for Python but it didn't seem to find anything useful -- it singled out random lines in the code. :-( On Wed, Nov 24, 2021 at 10:13 AM Terry Reedy wrote: > On 11/23/2021 6:21 PM, Guido van Rossum wrote: > > > Thanks Antoine. We definitely need

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-23 Thread Guido van Rossum
Emery Berger video linked there if you haven't already). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___ Python-

[Python-Dev] Re: Please be careful about changing PEPs post-submission to the SC

2021-11-18 Thread Guido van Rossum
an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/ZLC3H2XLEYJLFV3TRQ2EWRKRGZZ7DRMC/ > Code of Conduct: http://python.org/psf/codeofconduct/

[Python-Dev] Re: SC Acceptance: PEP 646 -- Variadic Generics

2021-11-17 Thread Guido van Rossum
Accepted, and to merge your > changes to Python 3.11 at your convenience. > > With our appreciation, > -Barry (on behalf of the Python Steering Council) > > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com

[Python-Dev] Re: Update colorsys with YUV conversions?

2021-11-12 Thread Guido van Rossum
thon.org/archives/list/python-dev@python.org/message/FV73RE3TSWDYBOJLZIONUJCX6FA32SZB/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02

[Python-Dev] Re: Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread Guido van Rossum
ython.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/LZOOLX5EKOITW55TW7JQYKLXJUPCAJB4/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http

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

2021-11-09 Thread Guido van Rossum
r and one > supplies one positional argument, then that argument must be bound to > that parameter name. > Terry, maybe that is *your* proposal. But Sebastian's proposal works like he describes. You can argue that there is a problem with those semantics, but you cannot argue that that is not

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

2021-11-09 Thread Guido van Rossum
he empty set emphatically is a subset of all sets (this is the most basic mainstream set theory you can think of). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___

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

2021-11-08 Thread Guido van Rossum
f F1 and F3: flags = 0b101 F1 & flags is a bitwise AND of 0b001 and 0b101, which of course is 0b001 (and so on): F1 & flags == 0b001 & 0b101 == 0b001 F2 & flags == 0b010 & 0b101 == 0b000 F3 & flags == 0b100 & 0b101 == 0b100 IF weird_case is F2 combined with F3,

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

2021-11-08 Thread Guido van Rossum
SomeFlag.something <-- ??? > This case definitely sounds to me like there is that confusion. Assuming 'nothing' is zero, it is not an *element*, so it should not be tested with 'in'. The 'in' operator should only be used if the left operator represents exactly one flag set. -- --Guido van Rossum (python.org/~

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

2021-10-31 Thread Guido van Rossum
Remember that py stone is a terrible benchmark. It only exercises a few byte codes and a modern CPU’s caching and branch prediction make minced meat of those. Sam wrote a whole new register-based VM so perhaps that exercises different byte codes. On Sun, Oct 31, 2021 at 05:19 Skip Montanaro

[Python-Dev] Re: Type annotations, PEP 649 and PEP 563

2021-10-23 Thread Guido van Rossum
(Off-topic) On Sat, Oct 23, 2021 at 07:42 Steven D'Aprano wrote: > I expect that people were using strings for forward references before > PEP 484, but it was 484 that made it official. I doubt it. We invented that specifically for mypy. I am not aware of any prior art. —Guido > > --

[Python-Dev] Re: Type annotations, PEP 649 and PEP 563

2021-10-21 Thread Guido van Rossum
NameError" > faction, including Guido (IIUC). > Yes, I still want this part of your PEP changed. I find your characterization of my position misleading -- there is no rule to break here(*), just an API. (*) The Zen of Python does not have rules. -- --Guido van Rossum (python.org/~guido)

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

2021-10-18 Thread Guido van Rossum
of Python users, but not of Python core devs). I worry that the experienced folks may perhaps be a little too eager to protect newbies from shooting themselves in the foot. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/

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

2021-10-18 Thread Guido van Rossum
's the kind of data you're given and that's the kind of app you have to write, and you can't control the format of the data. Using ?. this can be written as y = config?.get("handler")?.get("parameters")?.get("y") More examples are in PEP 505 itself, see https://www.pyt

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

2021-10-16 Thread Guido van Rossum
Wasn't there a change in a micro version of Python 2? I can't remember > the details, but from hindsight it was seen as a mistake that should not > be repeated. > That was in the olden days. In particular, bool() and True/False were introduced in Python 2.2.1 ( https://docs.python.org/2.7/library/f

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

2021-10-15 Thread Guido van Rossum
). + Address edge cases like trailing commas, `Concatenate` for `ParamSpec`, > and runtime value of the expression. > + Explicitly discuss the function-name-as-a-type proposal. > > We will be drafting the PEP over the coming month. > Awesome. You have my blessing. -- --Guido van Rossu

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

2021-10-14 Thread Guido van Rossum
dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/XZZIV42XGG3EIHRBBCCTTCFPWWSOT7MX/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van

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

2021-10-13 Thread Guido van Rossum
is a string should also work, so int() can't call __trunc__ (as was explained earlier in the thread). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun

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

2021-10-11 Thread Guido van Rossum
On Mon, Oct 11, 2021 at 3:22 PM Erik Demaine wrote: > On Mon, 11 Oct 2021, Guido van Rossum wrote: > No, I didn't write that, Lukasz did. > I always found the following more obvious: > > > > def data_to_table(d: Iterable[Mapping[str, float]], *, sort: bool = > False

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

2021-10-11 Thread Guido van Rossum
def Comparison(a: T, b: T) -> Literal[-1, 0, 1]: ... my first thought is that it's a comparison function that someone hasn't finished writing yet, not a function type -- since if it did have at least one line of code in the body, it *would* be that. -- --Guido van Rossum (python.org/~gui

[Python-Dev] Re: Why doesn't peephole optimise away operations with fast locals?

2021-10-10 Thread Guido van Rossum
ev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/73BMYW3TY7PJB7KRQ3Q3OROGU5UJVJAW/ > Code of Conduct:

[Python-Dev] Re: Why doesn't peephole optimise away operations with fast locals?

2021-10-10 Thread Guido van Rossum
On Sun, Oct 10, 2021 at 12:27 PM Patrick Reader <_...@pxeger.com> wrote: > On 10/10/2021 18:33, Guido van Rossum wrote: > > On Sun, Oct 10, 2021 at 10:28 AM Brandt Bucher > wrote: > >> the peephole optimizer shouldn’t be tasked with “fixing” poorly-written >>

[Python-Dev] Re: Why doesn't peephole optimise away operations with fast locals?

2021-10-10 Thread Guido van Rossum
mizer can prove that it can't raise a name error.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___ Python-D

[Python-Dev] Re: Why doesn't peephole optimise away operations with fast locals?

2021-10-10 Thread Guido van Rossum
iling list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/767FGRV4ZL5IVBHWSAW5TJGQMGQS244Z/ &g

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

2021-10-10 Thread Guido van Rossum
Maybe instead of tobytes() you can use memoryview(). On Sun, Oct 10, 2021 at 08:21 Facundo Batista wrote: > El dom, 10 de oct. de 2021 a la(s) 11:50, Serhiy Storchaka > (storch...@gmail.com) escribió: > > > > 10.10.21 17:19, Facundo Batista пише: > > > I have a long list of nums (several

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

2021-10-08 Thread Guido van Rossum
hon/cpython/pull/28488 -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/> ___ Python-Dev mailing list -- python-d

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

2021-10-08 Thread Guido van Rossum
ething introspectable is the same.) Union objects have an `__args__` attribute that gives the underlying types, and a `__parameters__` attribute giving any type variables. Note that the implementation of this introspectable type should ultimately be in C. -- --Guido van Rossum (python.org/~guido) *Pronou

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

2021-10-08 Thread Guido van Rossum
lace Callable in > the initial PEP (option 1) or to specify a more complete syntax from the > beginning (option 2). > > 5. Serhiy Storchaka > > > How could you replace Callable[..., int] and Callable[Concatenate[str, > P], int] ? > > To represent a Callable that accepts arbitr

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

2021-10-08 Thread Guido van Rossum
return x+1" and you can't write "f 42". Allowing the omission of the parentheses here would be inconsistent (even if some other languages allow it). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://femi

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

2021-10-08 Thread Guido van Rossum
To be clear, Sam’s basic approach is a bit slower for single-threaded code, and he admits that. But to sweeten the pot he has also applied a bunch of unrelated speedups that make it faster in general, so that overall it’s always a win. But presumably we could upstream the latter easily, separately

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

2021-10-06 Thread Guido van Rossum
some + expression group as e: … Argh. This would be very easy to overlook. As the senior author of PEP 654 I am going to go with "except*". Since it was shown that "except group" has ambiguous edge cases the proposals have gotten worse, which to me is a good sign that we

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

2021-10-04 Thread Guido van Rossum
The question was about which style to *recommend* (a la PEP-8). On Mon, Oct 4, 2021 at 8:03 AM 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 wrote: >> >>> Therefore my vote

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

2021-10-03 Thread Guido van Rossum
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 current lexer+parser. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here

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

2021-10-03 Thread Guido van Rossum
be bikeshedding the syntax. This thread was meant to solicit feedback on how to *format* it: does the space go before or after the '*'. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-

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

2021-10-03 Thread Guido van Rossum
We’ll, typically you don’t explicitly mention ExceptionGroup — it’s implied by the ‘except*’ syntax. Introducing match semantics probably wouldn’t open up new functionality, you can already write ‘except (E1, E2):’. On Sun, Oct 3, 2021 at 09:00 Thomas Grainger wrote: > What about `except case

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

2021-09-28 Thread Guido van Rossum
What I have heard repeatedly, from people who are paid to know, is that most users don’t care about the latest features, and would rather stick to a release until it becomes unsupported. (Extreme example: Python 2.) Numpy isn’t random, it’s at the bottom of the food chain for a large ecosystem or

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

2021-09-27 Thread Guido van Rossum
-optimizations`, which doesn't mention PGO -- IIUC it turns on PGO and LTO, if they're available. So my *actual* proposal (call it #2') is to use a separate compile-time flag, which is set by `./configure --enable-optimizations` regardless of whether PGO/LTO are possible, and which on Window

[Python-Dev] Re: Changing exception text in micro releases

2021-09-24 Thread Guido van Rossum
In this case I am inclined not to backport. In general we should look at existing usage before making changes. Somebody’s code might break — but does it matter? That depends on a lot of factors. E.g. if parsing an error message has become a common way to get useful info out of the error that is

[Python-Dev] Re: f-strings in the grammar

2021-09-21 Thread Guido van Rossum
t the time because we were coming from "{xxx}".format(...), where the parser doesn't know that the string is a format string. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singul

[Python-Dev] Re: f-strings in the grammar

2021-09-21 Thread Guido van Rossum
.py")}.c: $(srcdir)/{source}") print("\t$(COMMAND)") So these two tools, at least, seem to be doing all right (maybe because they both come from the JavaScript culture, where nested interpolations are well-known). -- --Guido van Rossum

[Python-Dev] Re: f-strings in the grammar

2021-09-20 Thread Guido van Rossum
ot;.py")}.c: $(srcdir)/{source}") ^ SyntaxError: f-string: unmatched '(' ``` -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-

[Python-Dev] Re: f-strings in the grammar

2021-09-20 Thread Guido van Rossum
On Mon, Sep 20, 2021 at 1:07 PM Patrick Reader <_...@pxeger.com> wrote: > > The current restrictions will also confuse some users (e.g. those used > to bash, and IIRC JS, where the rules are similar as what Pablo is > proposing). > > -- > > --Guido van Rossum (python

[Python-Dev] Re: f-strings in the grammar

2021-09-20 Thread Guido van Rossum
> https://mail.python.org/archives/list/python-dev@python.org/message/TWSJKE4KKSW7YD3OCHKGKJC52VUG6FY5/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Guido van Rossum
this works: for x in S(): ... However this doesn't: for x in iter(S()): ... In Steven's view, A does not deserve to work in the former case: Because A is a "broken" iterator, he seems to want it rejected by the iter() call that is *implicit* in the for-loop. Reminder about how for-loops work:

[Python-Dev] Re: python3.10rc2 compilation on android/termux/clang12.0.1 fails

2021-09-15 Thread Guido van Rossum
to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/KEURSMCLUVI7VPKM6M2VUV4JIW6FP66Z/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guid

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-15 Thread Guido van Rossum
On Tue, Sep 14, 2021 at 11:44 PM Steven D'Aprano wrote: > On Tue, Sep 14, 2021 at 09:38:38PM -0700, Guido van Rossum wrote: > > > > I don't know what I would call an object that only has __next__, > > > apart from "broken" :-( > > > > > > &

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
__next__, > apart from "broken" :-( > It's still an iterator, since it duck-types in most cases where an iterator is required (notably "for", which is the primary use case for the iteration protocols -- it's in the first sentence of PEP 234's abstract). -- -

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
On Tue, Sep 14, 2021 at 9:03 PM Steven D'Aprano wrote: > On Tue, Sep 14, 2021 at 12:33:32PM -0700, Guido van Rossum wrote: > > My view of this is: > > > > A. It's not an iterator if it doesn't define `__next__`. > > > > B. It is strongly recommended tha

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
On Tue, Sep 14, 2021 at 4:33 PM Brandt Bucher wrote: > Guido van Rossum wrote: > > On Tue, Sep 14, 2021 at 3:49 PM Brandt Bucher brandtbuc...@gmail.com > > wrote: > > > I think it's also worth noting that a missing "`__iter__` that returns > > > self" i

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
er things that don't follow the letter of the protocol, just to get things going. (This is common for complex protocols like Mapping, where some function you have no control over insists on a Mapping but only calls one or two common methods. Duck typing is alive and kicking! -- --Guido van Rossu

[Python-Dev] Re: Should the definition of an "(async) iterator" include __iter__?

2021-09-14 Thread Guido van Rossum
https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/3W7TDX5KNVQVGT5CUHBK33M7VNTP25DZ/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van

[Python-Dev] Re: Making code object APIs unstable

2021-09-07 Thread Guido van Rossum
On Tue, Sep 7, 2021 at 10:00 AM Stefan Behnel wrote: > Guido van Rossum schrieb am 07.09.21 um 00:44: > > In addition, I just heard from the SC that they've approved the > exception. > > So we will remove these two APIs from 3.11 without deprecation. > > Erm, hang on

[Python-Dev] Re: Making code object APIs unstable

2021-09-06 Thread Guido van Rossum
On Fri, Sep 3, 2021 at 4:12 PM Victor Stinner wrote: > On Thu, Sep 2, 2021 at 11:15 PM Guido van Rossum wrote: > > FWIW I've applied for an exception from the two-release deprecation > policy from the SC: > > https://github.com/python/steering-council/issues/75 > > On th

[Python-Dev] Re: A better way to freeze modules

2021-09-02 Thread Guido van Rossum
Quick reaction: This feels like a bait and switch to me. Also, there are many advantages to using a standard format like zip (many formats are really zip with some conventions). Finally, the bytecode format you are using is “marshal”, and is fully portable — as is zip. On Thu, Sep 2, 2021 at

[Python-Dev] Re: Discrepancy between what aiter() and `async for` requires on purpose?

2021-09-02 Thread Guido van Rossum
s the __[a]iter__ method call feels more > legitimate in the actual for loop syntax, it just feels odd to me if the > builtin isn't forcing the call. > > Cheers, > Nick. > >> > > > >> > ___ > Python-Dev mail

[Python-Dev] Re: Making code object APIs unstable

2021-09-02 Thread Guido van Rossum
ssage/TDLCJHNQSPNE7UXEJ33PV2VNQOPUFUT7/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/&

[Python-Dev] Re: Making code object APIs unstable

2021-09-01 Thread Guido van Rossum
for these two functions. That means: - Get rid of PyCode_NewWithPosArgs altogether - PyCode_New becomes unstable (and gets a new posinlyargcount argument) On Wed, Sep 1, 2021 at 11:52 AM Guido van Rossum wrote: > (context) > >> Guido van Rossum schrieb am 13.08.21 um 19:24: >&g

[Python-Dev] Re: Making code object APIs unstable

2021-09-01 Thread Guido van Rossum
(context) > Guido van Rossum schrieb am 13.08.21 um 19:24: > > In 3.11 we're changing a lot of details about code objects. Part of this > is > > the "Faster CPython" work, part of it is other things (e.g. PEP 657 -- > Fine > > Grained Error Locations in Trac

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

2021-08-26 Thread Guido van Rossum
weird interactions if a trace hook is > enabled during the initial start up of the interpreter and tries to trace > the proxy implementation code. > Of course. But it would still be interesting to have pseudo-code in your PEP showing the semantics you intend to implement -- that way we can c

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

2021-08-26 Thread Guido van Rossum
cost of the extra indirection is irrelevant, this is always going to be a slow interface meant for occasional use in a debugger. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-th

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

2021-08-26 Thread Guido van Rossum
would be the use case for that? I guess to start over with a computation. But there are better ways to do that. So let's not worry too much about preventing the user from shooting themselves in the foot -- surely at the global level, "globals().clear()" will do weird shit too. :-) -- --Guid

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

2021-08-26 Thread Guido van Rossum
On Thu, Aug 26, 2021 at 1:29 AM Nick Coghlan wrote: > On Mon, 23 Aug 2021 at 13:07, Guido van Rossum wrote: > > But... I also care about backwards compatibility, and I have a crazy > idea for making PyEval_GetLocals() work in a useful manner without > compromising the behavior

[Python-Dev] Re: Should PEP 8 be updated for Python 3 only?

2021-08-24 Thread Guido van Rossum
l.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/MK7N36L3XCXVY5R4DIIYIDU2W7EGJKZ3/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: h

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

2021-08-23 Thread Guido van Rossum
propose to fix the bug by not writing things back that way, instead writing back whenever a key in the proxy is set. The discussion is about subtler differences between the proposals. —Guido On Mon, Aug 23, 2021 at 22:19 Steven D'Aprano wrote: > On Sat, Aug 21, 2021 at 05:46:52PM -0700, Guido

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

2021-08-23 Thread Guido van Rossum
On Mon, Aug 23, 2021 at 8:46 AM Mark Shannon wrote: > Hi Guido, > > On 23/08/2021 3:53 pm, Guido van Rossum wrote: > > On Mon, Aug 23, 2021 at 4:38 AM Mark Shannon > <mailto:m...@hotpy.org>> wrote: > > > > Hi Nick, > > >

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

2021-08-23 Thread Guido van Rossum
. > None of this is clear (at least not to me) from PEP 558. > One problem with PEP 558 is that it's got too many words, and it's lacking a section that crisply describes the semantics of the proposed implementation. I've suggested to Nick that he add a section with pseudo-code for the impleme

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

2021-08-22 Thread Guido van Rossum
On Sat, Aug 21, 2021 at 8:52 PM Nick Coghlan wrote: > > On Sun, 22 Aug 2021, 10:47 am Guido van Rossum, wrote: > >> >> Everything here is about locals() and f_locals in *function scope*. (I >> use f_locals to refer to the f_locals field of frame objects

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

2021-08-22 Thread Guido van Rossum
Hm, I don’t think the major use for bchr() will be with a constant. On Sun, Aug 22, 2021 at 14:48 Gregory P. Smith wrote: > > On Tue, Aug 10, 2021 at 3:48 PM Christopher Barker > wrote: > >> On Tue, Aug 10, 2021 at 3:00 PM wrote: >> >>> The history of bytes/bytearray is a dual-purpose view.

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

2021-08-21 Thread Guido van Rossum
n3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/4RH5YCXIHIP6MRVTCOKOOO4GKCIMH4GJ/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pro

[Python-Dev] Re: Making code object APIs unstable

2021-08-17 Thread Guido van Rossum
en we change internal APIs that things >> depend on, the more people will move their projects towards doing the right >> thing with regards to either not using said APIs or rerunning an up to date >> code generator as part of their build instead of checking in generated >> unsta

[Python-Dev] Re: Making code object APIs unstable

2021-08-16 Thread Guido van Rossum
an idea now: the C equivalent to .replace() could use the same input structure; one can leave fields NULL that should be copied from the original unmodified. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <h

[Python-Dev] Re: Making code object APIs unstable

2021-08-16 Thread Guido van Rossum
On Mon, Aug 16, 2021 at 9:30 AM Steve Dower wrote: > On 8/16/2021 12:47 AM, Guido van Rossum wrote: > > My current proposal is to issue a DeprecationWarning in PyCode_New() and > > PyCode_NewWithPosArgs(), which can be turned into an error using a > > command-line flag. If i

[Python-Dev] Re: Making code object APIs unstable

2021-08-15 Thread Guido van Rossum
On Sat, Aug 14, 2021 at 4:56 AM Serhiy Storchaka wrote: > 13.08.21 20:24, Guido van Rossum пише: > > If these weren't part of the stable ABI, I'd choose (E). But because > > they are, I think only (A) or (B) are our options. The problem with (C) > > is that if there's co

[Python-Dev] Re: Making code object APIs unstable

2021-08-13 Thread Guido van Rossum
On Fri, Aug 13, 2021 at 11:17 AM Terry Reedy wrote: > On 8/13/2021 1:24 PM, Guido van Rossum wrote: > [...] > > Unfortunately, PyCode_New() and PyCode_NewWithPosArgs() are part of the > > PEP 387 stable ABI. What should we do? > > PEP 387 is Backwards Comp

[Python-Dev] Making code object APIs unstable

2021-08-13 Thread Guido van Rossum
especially interested in Petr's opinion given that this is a case where we'd like to deprecate something in the stable ABI. See also discussion in https://bugs.python.org/issue40222 (esp. near the end). -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun her

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

2021-08-12 Thread Guido van Rossum
I will try to find time to review the code. On Thu, Aug 12, 2021 at 08:56 Larry Hastings wrote: > > On 8/12/21 8:25 AM, Guido van Rossum wrote: > > Maybe we could specialize the heck out of this and not bother with a > function object? In the end we want to execute the cod

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

2021-08-12 Thread Guido van Rossum
nction objects for annotation too. > > Function objects are heavier than code objects. And they are GC-tracked > objects. > > I want to know how we can reduce the function objects created for > annotation in PEP 649, before deprecating PEP 563. > > -- > Inada Naoki >

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

2021-08-11 Thread Guido van Rossum
Oh, I agree it shouldn’t reference the typing module. But it should not raise NameError. This whole thing already is a special case. We can debate what else it should, e.g. skip the name, return a fixed error token, return an error token that includes the name that failed (this is part if the

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

2021-08-11 Thread Guido van Rossum
As it happens, I have a working prototype of lazy in marshaling that would work well for this. On Wed, Aug 11, 2021 at 06:07 Larry Hastings wrote: > On 8/11/21 5:21 AM, Inada Naoki wrote: > > But memory footprint and GC time is still an issue. > Annotations in PEP 649 semantics can be much

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

2021-08-10 Thread Guido van Rossum
gt;> > I implemented a version of this in > https://github.com/larryhastings/co_annotations/pull/3 but Larry didn't > like it. > However, I do like it, despite all Larry's arguing against it. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)*

<    1   2   3   4   5   6   7   8   9   10   >