On Tue, 12 Jan 2021, 11:55 am Ethan Furman, wrote:
> On 1/7/21 4:56 AM, Nick Coghlan wrote:
>
> > Both EnumMeta and ABCMeta should probably be relying on `__set_name__`
> > for their per-member set up work these days, rather than deferring
> > that work until after __new__ returns.
>
> And her
On 1/7/21 4:56 AM, Nick Coghlan wrote:
> Both EnumMeta and ABCMeta should probably be relying on `__set_name__`
> for their per-member set up work these days, rather than deferring
> that work until after __new__ returns.
And here I was thinking that `__set_name__` was for, well, setting the nam
Both EnumMeta and ABCMeta should probably be relying on __set_name__ for
their per-member set up work these days, rather than deferring that work
until after __new__ returns.
Cheers,
Nick.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscri
On 1/5/21 10:25 AM, Guido van Rossum wrote:
> On Tue, Jan 5, 2021 at 8:50 AM Ethan Furman wrote:
>> [...]
>> Perhaps `ABCMeta` can be easily fixed -- it is calling the function that
>> records all abstract methods, etc., after the `type.__new__` call; can
>> it be called before?
>
> Why do you ke
On Tue, Jan 5, 2021 at 8:50 AM Ethan Furman wrote:
> [...]
> Perhaps `ABCMeta` can be easily fixed -- it is calling the function that
> records all abstract methods, etc., after the
> `type.__new__` call; can it be called before?
>
Why do you keep insisting that this is "broken"? Yes, you have i
On 1/5/21 4:22 AM, Nick Coghlan wrote:
> On Wed, 30 Dec 2020 at 04:38, Ethan Furman wrote:
>> ... there will be a few custom metaclasses that need to move some code
>> from their `__new__` to `__init__` instead, and a few that need to add
>> an `__init__` to consume any keyword arguments that don
On Wed, 30 Dec 2020 at 04:38, Ethan Furman wrote:
> > No, we can't. There is a window where the subclass is initialized after
> > `typing_new()` returned before `__init__`
> > starts, and you propose to move the subclass after that window. There may
> > be code that depends on the class being
>
On Wed, Dec 30, 2020, 1:05 AM Guido van Rossum wrote:
> I need to think about this more.
>
> Technically the class *is* created at the point `__init_subclass__` is
> called. What the metaclass does after that point is embellishment.
>
> Most metaclasses will have sufficient control for their need
On 12/29/2020 10:00 PM, Guido van Rossum wrote:
I need to think about this more.
Both techniques could coexist.
Technically the class *is* created at the point `__init_subclass__` is
called. What the metaclass does after that point is embellishment.
Most metaclasses will have sufficient con
I need to think about this more.
Technically the class *is* created at the point `__init_subclass__` is
called. What the metaclass does after that point is embellishment.
Most metaclasses will have sufficient control for their needs because they
can manipulate the contents of the namespace that's
On 12/29/20 8:59 AM, Guido van Rossum wrote:
On Mon, Dec 28, 2020 at 10:24 PM Ethan Furman wrote:
The `__init_subclass__` and `__set_name__` protocols are intended to be run
before a new type is finished, but creating
a new type has three major steps:
- `__prepare__` to get the namespace
- `
On Mon, Dec 28, 2020 at 10:24 PM Ethan Furman wrote:
> 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 und
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
incl
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
https://mail.python.org/mailm
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 sourc
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 ye
Actually, there are a few steps that `type.__new__` perform that are not
customizable in metaclasses.
I had sometimes thought about mailing this here, or Python ideas, but could
not
come up with a "real world" use case where the customization of those
would be meaningful.
Let'me see if I recall
17 matches
Mail list logo