New submission from Ethan Furman :
The two subclasses in the test script are not calling super(). When they do,
both __init_subclasses__ are called.
--
nosy: +ethan.furman
resolution: -> not a bug
stage: -> resolved
status: open -&g
Change by Ethan Furman :
--
pull_requests: +22778
pull_request: https://github.com/python/cpython/pull/23927
___
Python tracker
<https://bugs.python.org/issue42
Ethan Furman added the comment:
New changeset 786d97a66cac48e7a933010367b8993a5b3ab85b by Ethan Furman in
branch 'master':
bpo-42727: [Enum] use super() and include **kwds (GH-23927)
https://github.com/python/cpython/commit/786d97a66cac48e7a933010367b899
Change by Ethan Furman :
--
pull_requests: -22792
___
Python tracker
<https://bugs.python.org/issue42727>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
If the patch in issue42775 is committed, this problem will be solved.
--
assignee: -> ethan.furman
superseder: -> __init_subclass__ should be called in __init__
___
Python tracker
<https://bugs.p
New submission from Ethan Furman :
PEP 487 introduced __init_subclass__ and __set_name__, and both of those were
wins for the common cases of metaclass usage.
Unfortunately, the implementation of PEP 487 with regards to __init_subclass__
has made the writing of correct metaclasses
Ethan Furman added the comment:
My understanding of using keywords in class headers
class MyClass(SomeBaseClass, setting='maybe'):
...
is that the keywords would get passed into the super classes
`__init_subclass__` (`SomeBaseClass` and `setting`).
However, in th
Change by Ethan Furman :
--
nosy: +ncoghlan
___
Python tracker
<https://bugs.python.org/issue42775>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22829
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23986
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
Guido, I just wanted to get it all in place while it was fresh in my mind.
Actual code tends to make a discussion easier. I'll make sure and transcribe
any relevant discussion from python-dev to
Ethan Furman added the comment:
That would be due to some changes to try and get `Enum` and `__init_subclass__`
to work together.
I'll revert those changes. Thank you for the report.
--
assignee: -> ethan.furman
priority: normal
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +22982
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24154
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
New changeset a581a868d97f649aedf868a1d27865a10925c73a by Ethan Furman in
branch 'master':
bpo-42851: [Enum] remove brittle __init_subclass__ support (GH-24154)
https://github.com/python/cpython/commit/a581a868d97f649aedf868a1d27865
Change by Ethan Furman :
--
pull_requests: +22983
pull_request: https://github.com/python/cpython/pull/24155
___
Python tracker
<https://bugs.python.org/issue42
Ethan Furman added the comment:
New changeset 9ab4dd452287169f08a8cf4d4c68c2139f8de714 by Ethan Furman in
branch '3.9':
[3.9] bpo-42851: [Enum] remove brittle __init_subclass__ support (GH-24154)
(GH-24155)
https://github.com/python/cpython/commit/9ab4dd452287169f08a8cf4d4c68c2
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9
___
Python tracker
<https://bugs.python.or
New submission from Ethan Furman :
In discussions about moving the calls to `__set_name__` and
`__init_subclass__`, Nick Coughlan made an observation:
Nick Coghlan:
> Both EnumMeta and ABCMeta should probably be relying on `__set_name__`
> for their per-member set up work these days,
Ethan Furman added the comment:
Nick Coghlan made the observation that `__set_name__` should be doing what is
currently the after-new work.
Tracking in #42901.
--
keywords: -patch
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
superseder:
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +23022
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24196
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
If an optimization changes semantics it's not an optimization.
In `if x: pass` how do we know `x` is falsely without calling `bool()` on it?
---
On a slightly different note, in the code:
if a and b:
...
why is `bool(a)` called
Ethan Furman added the comment:
I just finished a rewrite of Flag for 3.10. Using your test below I was able
to tweak the rewrite so the final numbers are:
Took normal 0.148092 seconds.
Took cached 0.017438 seconds.
Your original post had a ratio of nearly 200 -- it is now 8.7ish
Ethan Furman added the comment:
New changeset c314e60388282d9829762fb6c30b12e2807caa19 by Ethan Furman in
branch 'master':
bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196)
https://github.com/python/cpython/commit/c314e60388282d9829762fb6c30b12
Ethan Furman added the comment:
Yes.
--
___
Python tracker
<https://bugs.python.org/issue42915>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ethan Furman added the comment:
Final outcome:
`Flag` has been redesigned such that any flag comprised of a single bit is
canonical; flags comprised of multiple bits are considered aliases. During
iteration only canonical flags are returned.
--
resolution: -> fixed
stage: pa
Change by Ethan Furman :
--
pull_requests: +23042
pull_request: https://github.com/python/cpython/pull/24215
___
Python tracker
<https://bugs.python.org/issue38
Ethan Furman added the comment:
The code sample:
class Color(IntFlag):
BLACK = 0
RED = 1
GREEN = 2
BLUE = 4
PURPLE = RED | BLUE
WHITE = RED | GREEN | BLUE
Here's the summary of the changes:
- single-bit flags are canonical
- multi-bi
Ethan Furman added the comment:
This issue is not unique to Enum, and is not an Enum problem.
What is happening is that "test.py" has the `__name__` of `__main__` because it
is being directly executed from the command line, but when `test2.py` imports
it, it is being re-ex
Ethan Furman added the comment:
New changeset 7aaeb2a3d682ecba125c33511e4b4796021d2f82 by Ethan Furman in
branch 'master':
bpo-38250: [Enum] single-bit flags are canonical (GH-24215)
https://github.com/python/cpython/commit/7aaeb2a3d682ecba125c33511e4b47
Ethan Furman added the comment:
Thank you to everyone involved. :-)
To answer the first three points that started this issue:
1. iteration -> each single-bit flag in the entire flag, or a
combinations of flags, is returned one at a time -- not the
empty set, not other multi-bit val
Ethan Furman added the comment:
Fixed in 3.10 in issue38250.
Also fixed in my 3rd-party library, aenum 3.0:
(https://pypi.org/project/aenum/)
--
resolution: -> wont fix
stage: -> resolved
status: open -> closed
superseder: -> enum.Flag should be more s
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
pull_requests: +23161
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/24342
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
New changeset 01faf4542a8652adfbd3b3f897ba718e8ce43f5e by Ethan Furman in
branch 'master':
bpo-38250: [Enum] only include .rst test if file available (GH-24342)
https://github.com/python/cpython/commit/01faf4542a8652adfbd3b3f897ba71
Ethan Furman added the comment:
That patch was reject in favor of updating Enum to use `__set_name__` to do the
final creation of enum members.
The same thing could be done for ABC, but I lack the C skills to make it happen.
--
assignee: ethan.furman ->
superse
Change by Ethan Furman :
--
Removed message: https://bugs.python.org/msg386099
___
Python tracker
<https://bugs.python.org/issue35815>
___
___
Python-bugs-list m
Ethan Furman added the comment:
That patch was rejected in favor of updating Enum to use `__set_name__` to do
the final creation of enum members.
The same thing could be done for ABC, but I lack the C skills to make it happen.
--
___
Python
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ethan Furman added the comment:
This issue is fixed in #38250.
--
resolution: -> fixed
stage: needs patch -> resolved
status: open -> closed
superseder: -> enum.Flag should be more set-like
___
Python tracker
<https://bugs.python
Ethan Furman added the comment:
New changeset 2edaf6a4fb7e20324dde1423232f07211347f092 by Ken Jin in branch
'master':
bpo-8264: Document hasattr and getattr behavior for private attributes
(GH-23513)
https://github.com/python/cpython/commit/2edaf6a4fb7e20324dde1423232f07
Ethan Furman added the comment:
The code for that `__str__` seems very inefficient -- why doesn't it just do:
return self.name
?
-
The issue is not being able to access class attributes, the issue is whether
one enum member should be seen as an attribute of an
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +23276
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24486
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
New changeset d65b9033d6d092552775f6f5e41e7647100f9f2c by Ethan Furman in
branch 'master':
bpo-43162: [Enum] deprecate enum member.member access (GH-24486)
https://github.com/python/cpython/commit/d65b9033d6d092552775f6f5e41e76
Ethan Furman added the comment:
Dylan, it's not the `from_str()` method, but the `__str__` method that is the
problem. Instead of
def __str__(self):
if self is self.EXITCODE:
return 'exitcode'
it should be
def __str__(self):
cls =
Change by Ethan Furman :
--
pull_requests: +23277
pull_request: https://github.com/python/cpython/pull/24487
___
Python tracker
<https://bugs.python.org/issue43
Change by Ethan Furman :
--
assignee: -> ethan.furman
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue43098>
___
___
Python-bugs-list mai
Ethan Furman added the comment:
DeprecationWarning will be active in 3.10 and 3.11 with removal in 3.12.
--
___
Python tracker
<https://bugs.python.org/issue43
Ethan Furman added the comment:
New changeset 44e580f448016b86807465a186d03d9074e2b589 by Ethan Furman in
branch 'master':
bpo-43162: [Enum] update docs, renable doc tests (GH-24487)
https://github.com/python/cpython/commit/44e580f448016b86807465a186d03d
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ethan Furman added the comment:
You're welcome. Thank you for pushing the issue! :-)
--
___
Python tracker
<https://bugs.python.org/issue43162>
___
___
Change by Ethan Furman :
--
assignee: -> ethan.furman
___
Python tracker
<https://bugs.python.org/issue43430>
___
___
Python-bugs-list mailing list
Unsubscrib
Ethan Furman added the comment:
New changeset b5ecbf02e4dbdea6d1c9a6d7189137f76e70c073 by Miss Islington (bot)
in branch '3.8':
bpo-40025: Require _generate_next_value_ to be defined before members(GH-19763)
https://github.com/python/cpython/commit/b5ecbf02e4dbdea6d1c9a6d7189137
Ethan Furman added the comment:
New changeset ebd44003c9e206755e5e28716242ed8941495a62 by Miss Islington (bot)
in branch '3.7':
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19762)
https://github.com/python/cpython/commit/ebd44003c9e206755e5e28716242ed
Ethan Furman added the comment:
Not yet. I want to investigate the idea Ankesh Saha had some more.
--
versions: +Python 3.10 -Python 3.7, Python 3.8, Python 3.9
___
Python tracker
<https://bugs.python.org/issue40
Ethan Furman added the comment:
Which functionality?
- cgi.log()
- opening with current locale
I don't mind keeping the function, but if the file isn't already opened I think
using UTF-8 is an appropriate choice.
--
___
Python track
Ethan Furman added the comment:
Absolutely!
But first, you'll need to sign the Contributor License Agreement:
https://www.python.org/psf/contrib/contrib-form/
Thank you for your help!
--
___
Python tracker
<https://bugs.python.org/is
Ethan Furman added the comment:
The problem is that class B should raise an error as class A already has
members.
--
___
Python tracker
<https://bugs.python.org/issue41
Change by Ethan Furman :
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue39461>
___
___
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +21276
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/1
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
Antony,
My apologies for the delay.
What I would like to see is a real example of how you would use this new
feature if it were implemented. I'm guessing it would look something like:
class MyEnum(Enum):
locals.update(*some magic
Ethan Furman added the comment:
Guido, do you have an opinion on adding `RegexFlag` to the `re` module's
`__all__` and documenting it?
There is also some discussion on making these types of int-to-Enum conversions
use a `module.name` repr instead of `class.name`:
used to be:
>
Change by Ethan Furman :
--
pull_requests: +21282
pull_request: https://github.com/python/cpython/pull/7
___
Python tracker
<https://bugs.python.org/issue37
Change by Ethan Furman :
--
pull_requests: +21283
pull_request: https://github.com/python/cpython/pull/8
___
Python tracker
<https://bugs.python.org/issue37
Ethan Furman added the comment:
Thank you, Rubén, for the patch.
Thank you, Karthikeyan, for not making me backport it. :-)
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -P
Ethan Furman added the comment:
New changeset 38c8d3930eb872258a82339bcba3bce1d0e3ac2c by Ethan Furman in
branch '3.8':
[3.8] bpo-37479: Enum - use correct __format__ (GH-14545)
https://github.com/python/cpython/commit/38c8d3930eb872258a82339bcba3bc
Ethan Furman added the comment:
Thank you, Jason!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9 -Python 3.6
___
Python tracker
<https://bugs.python.or
Ethan Furman added the comment:
For Python code at least, Guido has proclaimed:
https://mail.python.org/pipermail/python-ideas/2016-September/042340.html
I recommend naming all enums UPPER_CASE. They're constants (within a
namespace) and that's the rule for constants. It's
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +21286
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22231
___
Python tracker
<https://bugs.python.org/issu
Ethan Furman added the comment:
Looks like the `re` module's flags have been updated separately in issue36548:
>>> import re
>>> re.I
re.IGNORECASE
>>> print(re.I)
# should also be re.IGNORECASE
>>> re.I|re.S|re.X
re.IGNORECA
Ethan Furman added the comment:
New changeset 542e1df2b018ee7068dba8076f2d6e84efd6e144 by Ethan Furman in
branch 'master':
bpo-40721: add note about enum member name case (GH-22231)
https://github.com/python/cpython/commit/542e1df2b018ee7068dba8076f2d6e
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ethan Furman added the comment:
Thanks, Dan, for checking this out. As you noted, a garbage collection solved
the issue, so I'm not going to worry about it.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
Change by Ethan Furman :
--
nosy: +ethan.furman
___
Python tracker
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Ethan Furman :
In issue36548 - Make the repr of re flags more readable - __str__ is set to
object.__str__. Hovewer, setting __str__ to object.__str__ means that EnumMeta
will replace __str__ with the first Enum's __str__ instead (Flag, in this case).
As ask
Ethan Furman added the comment:
>>> import re
>>> re.I
re.IGNORECASE
>>> print(re.I)
RegexFlag.IGNORECASE# according to comment in linked issue, this should be
`re.IGNORECASE` as well
--
___
Python tracker
<http
Ethan Furman added the comment:
"repr as inverse of eval" is nice to have, but it is not a requirement.
--
___
Python tracker
<https://bugs.python.o
Ethan Furman added the comment:
To answer the invariant question, see this post by Guido:
https://mail.python.org/pipermail/python-dev/2013-April/125716.html
--
___
Python tracker
<https://bugs.python.org/issue41
New submission from Ethan Furman :
If an Enum declares __str__, __repr__, __format__, or __reduce_ex__ to be
object`s, then it will get replaced by the base Enum's corresponding method.
E.g.:
class RegexFlag(IntFlag):
IGNORECASE = I = 2
def repr(self):
return &
Ethan Furman added the comment:
The behavior of not honoring the object.__str__ override is a bug in Enum and
currently being tracked in issue41789.
--
resolution: -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder: -> Enum: __str__ and frien
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +21306
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22250
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +21319
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22263
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
versions: +Python 3.10, Python 3.9 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue39587>
___
___
Python-bugs-list mailin
Ethan Furman added the comment:
Yes, the change only considered types with their own copy of `__new__` to be
actual data types, so in 3.6 `HexInt` was the recognized data type, but in 3.7+
it was `int` -- which also meant that HexEnum was considered a simple mix-in
and its `__repr__` was
Ethan Furman added the comment:
New changeset bff01f3a3aac0c15fe8fbe8b2f561f7927d117a1 by Ethan Furman in
branch 'master':
bpo-39587: Enum - use correct mixed-in data type (GH-22263)
https://github.com/python/cpython/commit/bff01f3a3aac0c15fe8fbe8b2f561f
Ethan Furman added the comment:
New changeset 95b81e2f8c955823dbf5632a817902b8a4916eaa by Miss Islington (bot)
in branch '3.9':
bpo-39587: Enum - use correct mixed-in data type (GH-22263) (GH-22266)
https://github.com/python/cpython/commit/95b81e2f8c955823dbf5632a817902
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
keywords: +patch
pull_requests: +21326
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22271
___
Python tracker
<https://bugs.python.org/issu
Change by Ethan Furman :
--
pull_requests: +21327
pull_request: https://github.com/python/cpython/pull/22272
___
Python tracker
<https://bugs.python.org/issue41
Change by Ethan Furman :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue41517>
___
___
Python-bug
Ethan Furman added the comment:
New changeset a4677068dd61662f5a56b184d5e3aa07db65b88e by Ethan Furman in
branch '3.9':
[3.9] bpo-41789: honor object overrides in Enum classes (GH-22250) (GH-22272)
https://github.com/python/cpython/commit/a4677068dd61662f5a56b184d5e3aa
Change by Ethan Furman :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ethan Furman :
--
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue39728>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ethan Furman :
--
pull_requests: +21330
pull_request: https://github.com/python/cpython/pull/22277
___
Python tracker
<https://bugs.python.org/issue39
Ethan Furman added the comment:
New changeset 3064dbf5df1021e85b507366a7ea448c8895efe7 by Ethan Furman in
branch 'master':
bpo-41517: do not allow Enums to be extended (#22271)
https://github.com/python/cpython/commit/3064dbf5df1021e85b507366a7ea44
Change by Ethan Furman :
--
assignee: -> ethan.furman
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
Ethan Furman added the comment:
New changeset c95ad7a91fbd7636f33a098d3b39964ab083bf49 by Ethan Furman in
branch 'master':
bpo-39728: Enum: fix duplicate `ValueError` (GH-22277)
https://github.com/python/cpython/commit/c95ad7a91fbd7636f33a098d3b3996
Change by Ethan Furman :
--
pull_requests: +21334
pull_request: https://github.com/python/cpython/pull/22282
___
Python tracker
<https://bugs.python.org/issue39
Change by Ethan Furman :
--
pull_requests: +21335
pull_request: https://github.com/python/cpython/pull/22283
___
Python tracker
<https://bugs.python.org/issue39
Change by Ethan Furman :
--
pull_requests: +21336
pull_request: https://github.com/python/cpython/pull/22284
___
Python tracker
<https://bugs.python.org/issue40
Change by Ethan Furman :
--
pull_requests: +21337
pull_request: https://github.com/python/cpython/pull/22285
___
Python tracker
<https://bugs.python.org/issue40
Ethan Furman added the comment:
There was an effort to make it so `_generate_next_value_` could be defined last
and still work correctly -- unfortunately, it could not handle the more common
case of using `auto()` with the default `_generate_next_value_`:
class I(Enum):
first = auto
401 - 500 of 1868 matches
Mail list logo