summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2020-12-10 21:07:00 (GMT)
committerGitHub <noreply@github.com>2020-12-10 21:07:00 (GMT)
commita65828717982e6a56382d7aff738478f5b5b25d0 (patch)
treec8148582ad4dc68cd969531dc64a1bee8274756b /Misc
parentefb13be72cbf49edf591936fafb120fe1b7d59f7 (diff)
downloadcpython-a65828717982e6a56382d7aff738478f5b5b25d0.zip
cpython-a65828717982e6a56382d7aff738478f5b5b25d0.tar.gz
cpython-a65828717982e6a56382d7aff738478f5b5b25d0.tar.bz2
bpo-34750: [Enum] add `_EnumDict.update()` support (GH-23725)
This allows easier Enum construction in unusual cases, such as including dynamic member definitions into a class definition: # created dynamically foo_defines = {'FOO_CAT': 'aloof', 'BAR_DOG': 'friendly', 'FOO_HORSE': 'big'} class Foo(Enum): vars().update({ k: v for k, v in foo_defines.items() if k.startswith('FOO_') }) def upper(self): # example method return self.value.upper()
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2020-12-09-14-15-48.bpo-34750.x8TASR.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2020-12-09-14-15-48.bpo-34750.x8TASR.rst b/Misc/NEWS.d/next/Library/2020-12-09-14-15-48.bpo-34750.x8TASR.rst
new file mode 100644
index 0000000..c98ba14
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-12-09-14-15-48.bpo-34750.x8TASR.rst
@@ -0,0 +1 @@
+[Enum] `_EnumDict.update()` is now supported