[issue43430] Exception raised when attempting to create Enum via functional API

2022-01-17 Thread Ethan Furman


Ethan Furman  added the comment:

Thanks for the reminder.

--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2022-01-17 Thread Irit Katriel


Irit Katriel  added the comment:

Is there a bug/documentation change to make here or can this be closed?

--
nosy: +iritkatriel
status: open -> pending
type: crash -> behavior
versions: +Python 3.10 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-04-21 Thread Ethan Furman


Ethan Furman  added the comment:

That sounds more like the way it is intended to be used: make you base enum 
with all the changes you want, then use that base enum either by inheriting 
from it or as a function call:

class MyBaseEnum(Enum, metaclass=...):
... custom stuff ...
... custom stuff ...

class MyRealEnum1(MyBaseEnum):
NAME = value
NAME = value

MyRealEnum2 = MyBaseEnum("MyRealEnum2", [('NAME', value), ('NAME', value)])

What change did you need with `__getitem__`?  Maybe there is a way to 
accomplish that goal without subclassing EnumMeta.

--

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-04-21 Thread Suhail S.


Suhail S.  added the comment:

In my usecase, I wanted to override the behaviour of __getitem__. I was able to 
accomplish this by subclassing EnumMeta. 

Having done so, I was able to work around this bug as follows. Instead of 
trying to access the functional API via Enum (using an enum as the type 
parameter) and failing, I was able to succeed by accessing the functional API 
via subclass of Enum. Something like:
MyEnum2 = MyEnumBase1(...)

--

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-04-11 Thread Ethan Furman


Ethan Furman  added the comment:

Looking at your example I see that you are using an enum as the `type` 
parameter -- the purpose of `type` is to provide a mixin data type, such as 
`int` or `str`, not another enum.

What is your use-case?  Typically, subclassing EnumMeta is not needed.

--

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-08 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-07 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman

___
Python tracker 

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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-07 Thread Suhail S.


Change by Suhail S. :


--
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



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-07 Thread Suhail S.


New submission from Suhail S. :

It is possible to create custom Enum classes with a metaclass that is a subtype 
of EnumMeta. It is also possible to inherit from such an enumeration to create 
another enumeration. However, attempting to do so via the functional API raises 
an exception. See attached file that highlights minimal failing test case.

--
components: Library (Lib)
files: test.py
messages: 388255
nosy: suhailsingh247
priority: normal
severity: normal
status: open
title: Exception raised when attempting to create Enum via functional API
type: crash
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49855/test.py

___
Python tracker 

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