> On 14 Oct 2017, at 16:37, Martin Teichmann wrote:
>
>> Things that will not work if Enum does not have a metaclass:
>>
>> list(EnumClass) -> list of enum members
>> dir(EnumClass) -> custom list of "interesting" items
>> len(EnumClass) -> number of members
>>
On 14 October 2017 at 17:49, Ethan Furman wrote:
> The problem with PEP 560 is that it doesn't allow the class definition
> protections that a metaclass does.
>
Since the discussion turned to PEP 560, I can say that I don't want this to
be a general mechanism, the PEP
On 10/14/2017 07:37 AM, Martin Teichmann wrote:
Things that will not work if Enum does not have a metaclass:
list(EnumClass) -> list of enum members
dir(EnumClass) -> custom list of "interesting" items
len(EnumClass) -> number of members
member in EnumClass -> True or False
- protection from
On 15 October 2017 at 01:00, Martin Teichmann
wrote:
> While I am not worried about the poor computers having to do a lot of
> work creating a throwaway class, I do see the problem with the new
> super. What I would like to see is something like the @wraps decorator
>
>> I do worry that things like your autoslots decorator example might be
>> problematic because they create a new class, throwing away a lot of work
>> that was already done. But perhaps the right way to address this would be
>> to move the decision about the instance layout to a later phase? (Not
> Things that will not work if Enum does not have a metaclass:
>
> list(EnumClass) -> list of enum members
> dir(EnumClass) -> custom list of "interesting" items
> len(EnumClass) -> number of members
> member in EnumClass -> True or False
>
> - protection from adding, deleting, and changing
On Fri, Oct 13, 2017, at 02:30, Nick Coghlan wrote:
> Metaclasses currently tend to serve two distinct purposes:
>
> 1. Actually altering the runtime behaviour of a class and its children
>in non-standard ways (e.g. enums, ABCs, ORMs)
> 2. Boilerplate reduction in class definitions, reducing
>
> Date: Fri, 13 Oct 2017 08:57:00 -0700
> From: Guido van Rossum
> To: Martin Teichmann
> Cc: Python-Dev
> Subject: Re: [Python-Dev] What is the design purpose of metaclasses vs
> code generating decorators? (was Re:
On 10/13/2017 02:35 AM, Martin Teichmann wrote:
Metaclasses currently tend to serve two distinct purposes:
1. Actually altering the runtime behaviour of a class and its children in
non-standard ways (e.g. enums, ABCs, ORMs)
2. Boilerplate reduction in class definitions, reducing the amount of
This is food for thought. I'll have to let it sink in a bit, but you may be
on to something.
Since the question was asked at some point, yes, metaclasses are much older
than class decorators. At some point I found the book Putting Metaclasses
to Work by Ira Forman and Scott Danforth (
On 13 October 2017 at 19:35, Martin Teichmann
wrote:
> > Metaclasses currently tend to serve two distinct purposes:
> >
> > 1. Actually altering the runtime behaviour of a class and its children in
> > non-standard ways (e.g. enums, ABCs, ORMs)
> > 2. Boilerplate
While I really can't continue to be active in this discussion now [*], here
are some thoughts based on observations I made:
These three PEPs are all essentially solving an occurrence of the same
problem:
PEP 549 Instance descriptors
PEP 562 Module __getattr__
PEP 560 Core support for generic
> Metaclasses currently tend to serve two distinct purposes:
>
> 1. Actually altering the runtime behaviour of a class and its children in
> non-standard ways (e.g. enums, ABCs, ORMs)
> 2. Boilerplate reduction in class definitions, reducing the amount of code
> you need to write as the author of
On 13 October 2017 at 04:21, Martin Teichmann
wrote:
> For me, the dataclasses were a typical example for inheritance, to be
> more precise, for metaclasses. I was astonished to see them
> implemented using decorators, and I was not the only one, citing
> Guido:
>
> > I
14 matches
Mail list logo