[Python-Dev] Re: PEP 661: Sentinel Values

2021-06-06 Thread Kyle Stanley
As someone who's had to make use of the pattern `_sentinel = object()` a few times within stdlib code, I'd like to give a strong +1 for the proposal to add a new `sentinel()` function. This is much more intuitive, easier to look up, etc. From my experience, it's a common enough pattern to be well

[Python-Dev] Making PY_SSIZE_T_CLEAN not mandatory.

2021-06-06 Thread Inada Naoki
Hi, folks, Since Python 3.8, PyArg_Parse*() APIs and Py_BuildValue() APIs emitted DeprecationWarning when '#' format is used without PY_SSIZE_T_CLEAN defined. In Python 3.10, they raise a RuntimeError, not a warning. Extension modules can not use '#' format with int. So how about making

[Python-Dev] Re: Why list.sort() uses mergesort and not timsort?

2021-06-06 Thread Dan Stromberg
On Sun, Jun 6, 2021 at 2:46 AM Marco Sulla wrote: > As title. Is it faster for inplace sorting, or simply the > implementation of list.sort() was done before the implementation of > timsort? > As you already know, timsort is pretty close to merge sort. Timsort added the innovation of making

[Python-Dev] Re: name for new Enum decorator

2021-06-06 Thread Irit Katriel via Python-Dev
 > On 6 Jun 2021, at 16:58, Andrei Kulakov wrote: > > > In Math / CompSci there is a definition that almost exactly matches this: > Exact Cover - https://en.wikipedia.org/wiki/Exact_cover > > The difference is that, IIRC, solving the problem is finding and removing all > subsets that are

[Python-Dev] Re: name for new Enum decorator

2021-06-06 Thread Andrei Kulakov
On Thu, May 27, 2021 at 11:31 PM Ethan Furman wrote: > Greetings! > > The Flag type in the enum module has had some improvements, but I find it > necessary to move one of those improvements > into a decorator instead, and I'm having a hard time thinking up a name. > > What is the behavior?

[Python-Dev] Re: Why list.sort() uses mergesort and not timsort?

2021-06-06 Thread Marco Sulla
On Sun, 6 Jun 2021 at 11:57, Christian Heimes wrote: > > On 06/06/2021 11.42, Marco Sulla wrote: > > As title. Is it faster for inplace sorting, or simply the > > implementation of list.sort() was done before the implementation of > > timsort? > > list.sort() uses timsort. What makes you think

[Python-Dev] Re: name for new Enum decorator

2021-06-06 Thread Steve Holden
On Fri, May 28, 2021 at 10:26 PM Ethan Furman wrote: > On 5/28/21 12:43 AM, Petr Viktorin wrote: > > On 28. 05. 21 5:24, Ethan Furman wrote: > > >> class FlagWithMasks(IntFlag): > >> DEFAULT = 0x0 > >> > >> FIRST_MASK = 0xF > >> FIRST_ROUND = 0x0 > >>

[Python-Dev] Re: Why list.sort() uses mergesort and not timsort?

2021-06-06 Thread Christian Heimes
On 06/06/2021 11.42, Marco Sulla wrote: > As title. Is it faster for inplace sorting, or simply the > implementation of list.sort() was done before the implementation of > timsort? list.sort() uses timsort. What makes you think that Python uses mergesort? Tim Peters invented timsort for Python

[Python-Dev] Why list.sort() uses mergesort and not timsort?

2021-06-06 Thread Marco Sulla
As title. Is it faster for inplace sorting, or simply the implementation of list.sort() was done before the implementation of timsort? ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org

[Python-Dev] Re: Proposal: declare "unstable APIs"

2021-06-06 Thread Serhiy Storchaka
06.06.21 06:48, Guido van Rossum пише: > On Fri, Jun 4, 2021 at 6:15 AM Victor Stinner > wrote: > If possible, I would prefer to make PyThreadState, PyCodeObject and > other structures opaque, and only go through getter and setter > functions ;-)

[Python-Dev] PEP 661: Sentinel Values

2021-06-06 Thread Tal Einat
Hi, I have prepared a PEP proposing adding a stdlib function for defining sentinel values. You can find the PEP here: https://www.python.org/dev/peps/pep-0661/ The discussion is happening in the discourse server: https://discuss.python.org/t/pep-661-sentinel-values/9126 To avoid splitting the