Message378913
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? |
|
Date |
User |
Action |
Args |
2020-10-18 23:11:28 | iritkatriel | set | recipients:
+ iritkatriel, falsetru, eric.smith, Claudiu.Popa, levkivskyi, Kevin Shweh |
2020-10-18 23:11:28 | iritkatriel | set | messageid: <1603062688.23.0.945968200427.issue38947@roundup.psfhosted.org> |
2020-10-18 23:11:28 | iritkatriel | link | issue38947 messages |
2020-10-18 23:11:28 | iritkatriel | create | |
|