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

2021-05-14 Thread micro codery
I think that would be the primary motivating factor behind recommending Ellipsis, it’s already a builtin and we are not likely it to get another builtin singleton. Ever? But besides that “...” in a function signature, although maybe looking magical, does immediately call out to the reader that

[Python-Dev] Re: Speeding up CPython

2021-05-14 Thread Nick Coghlan
On Fri, 14 May 2021, 1:47 am Stéfane Fermigier, wrote: > > > On Thu, May 13, 2021 at 8:42 AM Abdur-Rahmaan Janhangeer < > arj.pyt...@gmail.com> wrote: > >> Actual quote by "a Python Software Foundation fellow and contrib- >> utor to Python infrastructure projects" >> > > Ah, this is what you

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

2021-05-14 Thread Joao S. O. Bueno
Since the subject is this, I will note that past week, I resorted twice to create an Enum with a single element, and then alias the element on the module namespace, so that it would work as a "polished" sentinel. So: import enum class Whatever(enum.Enum): EMPTY = "EMPTY" EMPTY =

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

2021-05-14 Thread Nick Coghlan
On Sat, 15 May 2021, 5:39 am Tal Einat, wrote: (snip useful feature summary) The common `SENTINEL = object()` idiom fails #3, #4 and #5. This is > what I've been using for years, and I now think that it isn't good > enough. This not having a nice repr is what started this thread. > > I'd also

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

2021-05-14 Thread David Mertz
I think it's more future-looking to allow pickle round-tripping. Just add a ._uuid attribute and have object equality follow equality of that attribute. There's no reason to expose that in the .__repr__, but it would be inspectable in concept. On Fri, May 14, 2021, 7:01 PM Irit Katriel via

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

2021-05-14 Thread Irit Katriel via Python-Dev
If we drop the requirement for pickle round-tripping then I would add a requirement that sentinel is unpicklable, to prevent accidents. Irit On Fri, May 14, 2021 at 8:38 PM Tal Einat wrote: > > I'll try to organize my thoughts a bit here. This is a bit long, > welcome to skip to the final

[Python-Dev] Re: PEP 659: Specializing Adaptive Interpreter

2021-05-14 Thread Steve Holden
On Thu, May 13, 2021 at 11:07 PM Steven D'Aprano wrote: > Steve > (one of the other ones) > We are all other Steves! ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org

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

2021-05-14 Thread Tal Einat
On Fri, May 14, 2021 at 12:45 PM Steve Dower wrote: > > On 14May2021 0622, micro codery wrote: > > > > There was a discussion a while back ( a year or so?? ) on > > Python-ideas that introduced the idea of having more "sentinel-like" > > singletons in Python -- right now, we only have

[Python-Dev] Summary of Python tracker Issues

2021-05-14 Thread Python tracker
ACTIVITY SUMMARY (2021-05-07 - 2021-05-14) Python tracker at https://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open7429 ( +1) closed 48441 (+64) total 55870 (+65) Open issues

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

2021-05-14 Thread Barry Warsaw
On May 14, 2021, at 02:38, Chris Angelico wrote: > > Do we ever really need the ability to pass a specific sentinel to a > function, or are we actually looking for a way to say "and don't pass > this argument”? Very often, that’s the case. Such a “it’s okay to not pass this argument”

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

2021-05-14 Thread Chris Angelico
On Sat, May 15, 2021 at 2:04 AM Barry Warsaw wrote: > > On May 14, 2021, at 02:38, Chris Angelico wrote: > > > > Do we ever really need the ability to pass a specific sentinel to a > > function, or are we actually looking for a way to say "and don't pass > > this argument”? > > Very often,

[Python-Dev] Re: PEP 659: Specializing Adaptive Interpreter

2021-05-14 Thread Fabio Zadrozny
> > > 3. Another example: I'm working right now on a feature to step into a > > method. To do that right now my approach is: > > - Compute the function call names and bytecode offsets in a given > > frame. > > - When a frame is called (during a frame.f_trace call), check the > > parent

[Python-Dev] Re: PEP 659: Specializing Adaptive Interpreter

2021-05-14 Thread Mark Shannon
Hi Fabio, On 13/05/2021 7:11 pm, Fabio Zadrozny wrote: Em qua., 12 de mai. de 2021 às 14:45, Mark Shannon > escreveu: Hi everyone, I would like to present PEP 659. This is an informational PEP about a key part of our plan to improve CPython

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

2021-05-14 Thread Steve Dower
On 14May2021 0622, micro codery wrote: There was a discussion a while back ( a year or so?? ) on Python-ideas that introduced the idea of having more "sentinel-like" singletons in Python -- right now, we only have None. Not quite true, we also have Ellipsis, which already has a

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

2021-05-14 Thread Chris Angelico
On Fri, May 14, 2021 at 7:31 PM Petr Viktorin wrote: > Perhaps it would be beneficial to provide a common base class or > factory, so we get a good repr. But I don't think another common value > like None and Ellipsis would do much good. > Agreed - I think Sentinel would make a great class, from

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

2021-05-14 Thread Petr Viktorin
On 14. 05. 21 10:55, Victor Stinner wrote: Hi Tal, Would it make sense to have an unique singleton for such sentinel, a built-in singleton like None or Ellipsis? I propose the name "Sentinel". Sentinel would be similar to None, but the main property would be that "Sentinel is None" is false

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

2021-05-14 Thread Victor Stinner
Hi Tal, Would it make sense to have an unique singleton for such sentinel, a built-in singleton like None or Ellipsis? I propose the name "Sentinel". Sentinel would be similar to None, but the main property would be that "Sentinel is None" is false :-) The stdlib contains tons of sentinels: *