[Python-Dev] Re: Should dataclasses add__set__ (and possibly __get __) descriptors ?

2021年12月13日 10:53:08 -0800

I'm also confused about what you are trying to achieve here. Note that:
assert Entries.ENTRY1.value.a == 1
should work.
But my main thought is that dataclasses are really just a way to
auto-generate classes without having to write a bunch of boilerplate. So
you example above is equivalent to:
class Foo:
 def __init__(self, a=0):
 self.a = a
Which behaves the same way when used the same way with Enum.
So why should dataclasses be special in this particular way?
-CHB
-- 
Christopher Barker, PhD (Chris)
Python Language Consulting
 - Teaching
 - Scientific Software Development
 - Desktop GUI and Web Development
 - wxPython, numpy, scipy, Cython
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/J7EEZUO7MI7RZT347C6VETUPCGBZIUYJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to