Irit Katriel <[email protected]> added the comment:
If I change Foo in your code to:
@dataclass(init=False)
class Foo:
callback: Callable[[int], int] = lambda x: x**2
Then the same TypeError exception is raised for Foo.
If I then change it back (remove the init=False so that it picks up the default
value of True), and then change init=True in field:
@dataclass
class Bar:
callback: Callable[[int], int] = field(init=True, default=lambda x: x**2)
Then I get the expected output of
4
4
What do you consider to be an inconsistency here?
----------
nosy: +iritkatriel
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38947>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com