[issue33976] Enums don't support nested classes

2019-07-17 Thread Ethan Furman


Ethan Furman  added the comment:

Edward,

I'm inclined to agree with you.  It will take a couple versions for 
deprecation, etc., to push this through (assuming nobody comes up with a good 
counter-argument).

In the mean-time, this change has landed in aenum [1] so you can use it now.


[1] https://pypi.org/project/aenum/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33976] Enums don't support nested classes

2018-06-27 Thread Edward Wang


Edward Wang  added the comment:

Ethan - thank you for your speedy response!

For an example you can see 
https://github.com/ucb-bar/hammer/blob/97021bc7e1c819747f8b8b6d4b8c76cdc6a488e3/src/hammer-vlsi/hammer_vlsi_impl.py#L195
 - the ObstructionType enum is really only used inside PlacementConstraintType, 
so it was thought to be logical to nest ObstructionType inside 
PlacementConstraintType and reference it as 
PlacementConstraintType.ObstructionType.

It just seemed weird that inline class definitions inside an Enum get treated 
as an enum value while functions defined inside Enums are treated as methods - 
as a user it would make more sense to have them both treated the same way (not 
as enum values), I think.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33976] Enums don't support nested classes

2018-06-27 Thread Ethan Furman


Ethan Furman  added the comment:

Edward, thank you for taking the time to submit a patch, complete with tests!

Do you have a real-world example of why Enum should work this way?

--
assignee:  -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33976] Enums don't support nested classes

2018-06-26 Thread Edward Wang


Change by Edward Wang :


--
keywords: +patch
pull_requests: +7557
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33976] Enums don't support nested classes

2018-06-26 Thread Edward Wang


New submission from Edward Wang :

Methods defined in Enums behave 'normally' but classes defined in Enums get 
mistaken for regular values and can't be used as classes out of the box.

```python
class Outer(Enum):
a = 1
b = 2
class Inner(Enum):
foo = 10
bar = 11
```

--
messages: 320541
nosy: edwardw
priority: normal
severity: normal
status: open
title: Enums don't support nested classes
type: behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com