New submission from Sergei Lebedev <sergei.a.lebe...@gmail.com>:

Motivating example:

>>> @dataclass
... class A:
...   x: InitVar[int] = 0
...   y: int = 1
... 
>>> a = A()
>>> a.x
0
>>> a.y
1

PEP-557 does not specify if fields annotated with InitVar[...] are available on 
the resulting dataclass. However, they are not part of the dataclass structure 
and are only used for __*init__ generation, so perhaps they shouldn't be? Wdyt?

----------
components: Library (Lib)
messages: 392058
nosy: eric.smith, superbobry
priority: normal
severity: normal
status: open
title: InitVar should not be available on a @dataclass-decorated class
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43953>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to