We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If auto has non-value arguments and is called successively all following calls will be set to the previous value. e.g.
from aenum import Enum, auto class A(Enum): _init_ = 'value comment' a = 1, 'comment for a' b = auto('comment for b') c = auto('comment for c')
In the above A.a and A.b are unique, but A.b == A.c - but if you do the following, everything is fine:
A.a
A.b
A.b == A.c
from aenum import Enum, auto class A(Enum): _init_ = 'value comment' a = 1, 'comment for a' b = auto('comment for b') d = 3, 'comment for d' c = auto('comment for c')
Also, if in above you set d = 2, 'comment for d', A.c is fine, but A.d == A.b.
d = 2, 'comment for d'
A.c
A.d == A.b
Somewhat related, it would be nice to be able to write a custom function to handle empty auto's / provide default arguments for init.
auto
The text was updated successfully, but these errors were encountered:
I think what you want to do might be this ?
from aenum import Enum, auto class A(Enum): _init_ = 'value comment' a = 1, 'comment for a' b = auto(), 'comment for b' c = auto(), 'comment for c'
seems to work fine ?
I actually came to this issue looking for a solution of your last sentence. If I am getting it right, this might be it :)
from aenum import Enum, AddValue class tst(Enum): def _generate_next_value_(name, start, count, last, *args, **kwargs): return (name,args[0]) _settings_ = AddValue _init_ = "value other" FOO = "hohoho"
Sorry, something went wrong.
No branches or pull requests
If auto has non-value arguments and is called successively all following calls will be set to the previous value. e.g.
In the above
A.a
andA.b
are unique, butA.b == A.c
- but if you do the following, everything is fine:Also, if in above you set
d = 2, 'comment for d'
,A.c
is fine, butA.d == A.b
.Somewhat related, it would be nice to be able to write a custom function to handle empty
auto
's / provide default arguments for init.The text was updated successfully, but these errors were encountered: