Skip to content

Commit

Permalink
Change runtime behavior to support introspection
Browse files Browse the repository at this point in the history
  • Loading branch information
debonte committed Jan 13, 2022
1 parent cb0e210 commit ccfa9c8
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions pep-9999.rst
Expand Up @@ -449,20 +449,16 @@ This example demonstrates::
Runtime behavior
----------------

At runtime, the ``dataclass_transform`` decorator has no effect. It
simply returns a function that accepts a single argument and returns
that argument as the return value.
At runtime, the ``dataclass_transform`` decorator's only effect is to
set a string attribute named ``__dataclass_transform__`` on the
decorated function or class to support introspection. The value of the
attribute should be a serialized dict containing the names and values
of the ``dataclass_transform`` parameters.

Here is its complete implementation::
For example::

def dataclass_transform(
*,
eq_default: bool = True,
order_default: bool = False,
kw_only_default: bool = False,
field_descriptors: Tuple[Union[type, Callable[..., Any]], ...] = (()),
) -> Callable[[_T], _T]:
return lambda a: a
'{"eq_default": True, "order_default": False, \
"kw_only_default": False, "field_descriptors": ()}'


Dataclass semantics
Expand Down

0 comments on commit ccfa9c8

Please sign in to comment.