Skip to content
New issue

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

Ability for format an Enum to change its format #64

Open
vincentbernat opened this issue Jan 20, 2017 · 2 comments
Open

Ability for format an Enum to change its format #64

vincentbernat opened this issue Jan 20, 2017 · 2 comments

Comments

@vincentbernat
Copy link
Owner

Hey

If you implement __format__(), you could enable a user to choose between ok(1), ok and 1. Think about it.

@paravoid
Copy link

paravoid commented May 2, 2020

Yeah, would be nice to be able to extract ok somehow. Right now this isn't possible at all as far as I can tell, one has to do hacks like e.entity.enum[int(e)].

Have you thought about using Python's native "Enum" or "IntEnum"? That would be an even more Pythonic way :) It's 3.4+, but there is backport in the form of the enum34 package if you still care about such old versions.

@vincentbernat
Copy link
Owner Author

We could switch Snimpy to be 3.4+ now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants