Roundup Robot added the comment:
New changeset b034418e840b by Ethan Furman in branch 'default':
Close #18635: Move class level private attribute from instance to class.
http://hg.python.org/cpython/rev/b034418e840b
--
nosy: +python-dev
resolution: - fixed
stage: - committed/rejected
Chris Lambacher added the comment:
My use case is a generic mixin for Enums and a generic mixin for Django ORM
fields that uses the Enums to generate choices.
The Enum mixin has to call cls.__class__._get_mixins_(cls.__bases__) to get the
member_type so that it can call the
Ethan Furman added the comment:
Well, aside from not having a clue as to what Chris is trying to do, should we
make _member_type_ public? The only reason I put it there was to aid
introspection -- Enum does not use it.
--
___
Python tracker
Eli Bendersky added the comment:
-1 on making more internals public.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18635
___
___
New submission from Chris Lambacher:
It would be useful to set the discovered member_type to the Enum class and not
just the instance. Attached is a patch to add _member_type_ to the enum_class.
--
files: enum_member_type_on_class.patch
keywords: patch
messages: 194199
nosy: lambacck
Changes by Ethan Furman et...@stoneleaf.us:
--
assignee: - ethan.furman
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18635
___
Ethan Furman added the comment:
Ah, so the Enum class has the mixin class as wall as / instead of the Enum
member (which should find it via normal attribute lookup).
I have no problem with that. I'll need to make a couple more changes to the
code, add a test, etc., etc.
It won't make the
Eli Bendersky added the comment:
Can you clarify why it would be useful? Note that we're talking about private
non-documented members here.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18635
Ethan Furman added the comment:
I also admit to being curious as to the reason it is useful, especially since
it is, at this point, an implementation detail.
Even so, it still makes more sense to have that attribute on the class instead
of the instance.
--