Ethan Furman <[email protected]> added the comment:
Okay, you convinced me. I would ask two things, though:
- use vars() instead of locals()
- split the one-liner ;)
class Foo(Enum):
vars().update({
k: v
for k, v in foo_defines.items()
if k.startswith('FOO_')
})
def some_method(self):
# do something
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34750>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com