homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Enum docs claim replacing __new__ is not possible
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ethan.furman, ezio.melotti, python-dev
Priority: normal Keywords: patch

Created on 2014年06月12日 18:35 by ethan.furman, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue21738.stoneleaf.01.patch ethan.furman, 2014年06月19日 23:21 review
Messages (4)
msg220372 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2014年06月12日 18:35
Replacing __new__ in an Enum subclass is not possible /in the subclass definition/, but is easily replaced via monkey-patching after the class has been defined.
Docs need to be updated to reflect this.
msg221037 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014年06月19日 22:00
Is this common enough that it deserves to be documented?
msg221052 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2014年06月19日 23:21
Common, no. And if the docs were silent on the matter that would be okay, but unfortunately the docs declare that it is not possible, which is just plain wrong.
Patch also mentions _value_ as that is the supported interface when customizing __new__ methods.
msg226974 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014年09月17日 02:14
New changeset 28c21f09719e by Ethan Furman in branch '3.4':
Issue21738: clarify usage of __new__ in Enum subclasses
https://hg.python.org/cpython/rev/28c21f09719e
New changeset 91ec34801232 by Ethan Furman in branch 'default':
Issue21738: clarify usage of __new__ in Enum subclasses
https://hg.python.org/cpython/rev/91ec34801232 
History
Date User Action Args
2022年04月11日 14:58:04adminsetgithub: 65937
2014年09月17日 02:15:54ethan.furmansetstatus: open -> closed

nosy: + docs@python
assignee: ethan.furman -> docs@python
resolution: fixed
stage: resolved
2014年09月17日 02:14:33python-devsetnosy: + python-dev
messages: + msg226974
2014年06月19日 23:21:25ethan.furmansetfiles: + issue21738.stoneleaf.01.patch
keywords: + patch
messages: + msg221052
2014年06月19日 22:00:59ezio.melottisetnosy: + ezio.melotti
messages: + msg221037

components: + Documentation
type: enhancement
2014年06月12日 18:35:45ethan.furmancreate

AltStyle によって変換されたページ (->オリジナル) /