This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients Claudiu.Popa, Kevin Shweh, eric.smith, falsetru, iritkatriel, levkivskyi
Date 2020-10-18.23:11:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603062688.23.0.945968200427.issue38947@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-10-18 23:11:28iritkatrielsetrecipients: + iritkatriel, falsetru, eric.smith, Claudiu.Popa, levkivskyi, Kevin Shweh
2020-10-18 23:11:28iritkatrielsetmessageid: <1603062688.23.0.945968200427.issue38947@roundup.psfhosted.org>
2020-10-18 23:11:28iritkatriellinkissue38947 messages
2020-10-18 23:11:28iritkatrielcreate