[Python-Dev] Re: __init_subclass__ and metaclasses

2020-12-28 Thread Ethan Furman
On 12/28/20 9:31 PM, Guido van Rossum wrote: Let me see if I can unpack this. I observe that `type.__new__() ` is really the C function `type_new()` in typeobject.c, and hence I will refer to it by that name. I understand that `type_new()` is the only way to create type objects, and it

[Python-Dev] Re: __init_subclass__ and metaclasses

2020-12-28 Thread Ethan Furman
Issue #42775: https://bugs.python.org/issue42775 PR #23986: https://github.com/python/cpython/pull/23986 ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org

[Python-Dev] Re: __init_subclass__ and metaclasses

2020-12-28 Thread Guido van Rossum
Let me see if I can unpack this. I observe that `type.__new__() ` is really the C function `type_new()` in typeobject.c, and hence I will refer to it by that name. I understand that `type_new()` is the only way to create type objects, and it includes a call to `__init_subclass__()`. In the

[Python-Dev] Re: __init_subclass__ and metaclasses

2020-12-28 Thread Joao S. O. Bueno
For the record - the 3rd process that is currently un-customizable when creating a class, i.e. things that happen in an opaque way inside `type.__new__`, is the ABC class machinery. I could not recall it when writing the previous e-mail. Still - I think this might be very little disruptive, and

[Python-Dev] Re: Enum bug?

2020-12-28 Thread Victor Stinner
IMO it's a feature, not a bug :-) >>> import enum >>> class Foo(enum.Enum): ... A = 1 ... B = 1.0 ... >>> Foo(1) >>> Foo(1.0) >>> Foo.B See: https://docs.python.org/dev/library/enum.html#duplicating-enum-members-and-values "However, two enum members are allowed to have the same value.

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Antoine Pitrou
On Tue, 29 Dec 2020 02:20:45 +0900 Inada Naoki wrote: > On Mon, Dec 28, 2020 at 10:53 PM Antoine Pitrou wrote: > > > > On Mon, 28 Dec 2020 11:07:46 +0900 > > Inada Naoki wrote: > > > > > > Additionally, if we introduce the customizable lazy str object, it's > > > very easy to release GIL

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Inada Naoki
On Mon, Dec 28, 2020 at 10:53 PM Antoine Pitrou wrote: > > On Mon, 28 Dec 2020 11:07:46 +0900 > Inada Naoki wrote: > > > > Additionally, if we introduce the customizable lazy str object, it's > > very easy to release GIL during basic Unicode operations. Many third > > parties may assume

[Python-Dev] Re: Where is the SQLite module maintainer

2020-12-28 Thread Erlend Aasland
On 27 Dec 2020, at 22:38, Christian Heimes mailto:christ...@python.org>> wrote: On 27/12/2020 21.20, Erlend Aasland wrote: […] Who can help me review code that touches the sqlite3 module code base? as far as I know we don't have an active module owner and maintainer any more. What about Berker

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Antoine Pitrou
On Mon, 28 Dec 2020 11:07:46 +0900 Inada Naoki wrote: > > Additionally, if we introduce the customizable lazy str object, it's > very easy to release GIL during basic Unicode operations. Many third > parties may assume PyUnicode_Compare doesn't release GIL if both > operands are Unicode objects.

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Ronald Oussoren via Python-Dev
> On 28 Dec 2020, at 14:00, Inada Naoki wrote: > > On Mon, Dec 28, 2020 at 8:52 PM Phil Thompson > wrote: >> >> >> I would have thought that an object was defined by its behaviour rather >> than by any particular implementation detail. >> > > As my understanding, the policy "an object was

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Inada Naoki
On Mon, Dec 28, 2020 at 8:52 PM Phil Thompson wrote: > > > I would have thought that an object was defined by its behaviour rather > than by any particular implementation detail. > As my understanding, the policy "an object was defined by its behavior..." doesn't mean "put unlimited amount of

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Phil Thompson via Python-Dev
On 28/12/2020 11:27, Inada Naoki wrote: On Mon, Dec 28, 2020 at 7:22 PM Phil Thompson wrote: > So I'm +1 to make Unicode simple by removing PyUnicode_READY(), and -1 > to make Unicode complicated by adding customizable callback for lazy > population. > > Anyway, I am OK to un-deprecate

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Phil Thompson via Python-Dev
On 28/12/2020 02:07, Inada Naoki wrote: On Sun, Dec 27, 2020 at 8:20 PM Ronald Oussoren via Python-Dev wrote: On 26 Dec 2020, at 18:43, Guido van Rossum wrote: On Sat, Dec 26, 2020 at 3:54 AM Phil Thompson via Python-Dev wrote: That wouldn’t be a solution for code using the

[Python-Dev] Enum bug?

2020-12-28 Thread Stephen J. Turnbull
Paul Bryan via Python-Dev writes: > Should this be considered a bug in the Enum implementation? Probably not. The underlying implementation of Enums is integers, and False and True *are* the integers 0 and 1 for most purposes. And it propagates further. Same example: >>> class

[Python-Dev] Re: Enhancement request for PyUnicode proxies

2020-12-28 Thread Ronald Oussoren via Python-Dev
> On 28 Dec 2020, at 03:58, Greg Ewing wrote: > > Rather than a full-blown buffer-protocol-like thing, could we > get by with something simpler? How about just having a flag > in the unicode object indicating that it doesn't own the > memory that it points to? I don’t know about the OP, but