| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| """ | ||
| def decorator(cls_or_fn): | ||
| cls_or_fn.__dataclass_transform__ = { |
There was a problem hiding this comment.
Do we need to use this pattern used in final?
try:
f.__final__ = True
except (AttributeError, TypeError):
# Skip the attribute silently if it is not writable.
# AttributeError happens if the object has __slots__ or a
# read-only property, TypeError if it's a builtin class.
pass
return f
Sorry, something went wrong.
There was a problem hiding this comment.
I was more careful there because we added the behavior later after the decorator was already in the wild, and I didn't want to accidentally break something. Here, we're adding a new decorator, so I think it makes sense to start with the simpler behavior and adjust it only if there's an actual need.
Sorry, something went wrong.
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Copied from typing-extensions (python/typing#1054, python/typing#1120). Documentation is intentionally omitted, so we can focus on getting the runtime part in before the feature freeze.
Copied from typing-extensions (python/typing#1054, python/typing#1120). Documentation is intentionally omitted, so we can focus on getting the runtime part in before the feature freeze.
| Back | FazBrowse Home | New Git URL |
From PEP 681.
cc @erictraut @debonte