How can I show the code that is generated when using @dataclass class decorator?
up vote
2
down vote
favorite
Python 3.7 introduces the dataclasses
module that contains a @dataclass
decorator. This decorator can generate class functions. How can I print these generated functions?
python python-3.7 python-dataclasses
add a comment |
up vote
2
down vote
favorite
Python 3.7 introduces the dataclasses
module that contains a @dataclass
decorator. This decorator can generate class functions. How can I print these generated functions?
python python-3.7 python-dataclasses
2
There's no easy way. You may be interested in DataclassInspector, a project that tries to do exactly that. If you want to look at what the functions are actually doing, you can usedis.dis
– Patrick Haugh
Nov 19 at 20:58
You can still inspect the generated signature:str(inspect.signature(YourDataClass.__init__))
– x0s
2 days ago
I've submitted a feature request github.com/ericvsmith/dataclasses/issues/139
– pylang
yesterday
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Python 3.7 introduces the dataclasses
module that contains a @dataclass
decorator. This decorator can generate class functions. How can I print these generated functions?
python python-3.7 python-dataclasses
Python 3.7 introduces the dataclasses
module that contains a @dataclass
decorator. This decorator can generate class functions. How can I print these generated functions?
python python-3.7 python-dataclasses
python python-3.7 python-dataclasses
edited Nov 20 at 14:13
Patrick Haugh
26.1k82546
26.1k82546
asked Nov 19 at 20:18
OrangeTux
5,92264060
5,92264060
2
There's no easy way. You may be interested in DataclassInspector, a project that tries to do exactly that. If you want to look at what the functions are actually doing, you can usedis.dis
– Patrick Haugh
Nov 19 at 20:58
You can still inspect the generated signature:str(inspect.signature(YourDataClass.__init__))
– x0s
2 days ago
I've submitted a feature request github.com/ericvsmith/dataclasses/issues/139
– pylang
yesterday
add a comment |
2
There's no easy way. You may be interested in DataclassInspector, a project that tries to do exactly that. If you want to look at what the functions are actually doing, you can usedis.dis
– Patrick Haugh
Nov 19 at 20:58
You can still inspect the generated signature:str(inspect.signature(YourDataClass.__init__))
– x0s
2 days ago
I've submitted a feature request github.com/ericvsmith/dataclasses/issues/139
– pylang
yesterday
2
2
There's no easy way. You may be interested in DataclassInspector, a project that tries to do exactly that. If you want to look at what the functions are actually doing, you can use
dis.dis
– Patrick Haugh
Nov 19 at 20:58
There's no easy way. You may be interested in DataclassInspector, a project that tries to do exactly that. If you want to look at what the functions are actually doing, you can use
dis.dis
– Patrick Haugh
Nov 19 at 20:58
You can still inspect the generated signature:
str(inspect.signature(YourDataClass.__init__))
– x0s
2 days ago
You can still inspect the generated signature:
str(inspect.signature(YourDataClass.__init__))
– x0s
2 days ago
I've submitted a feature request github.com/ericvsmith/dataclasses/issues/139
– pylang
yesterday
I've submitted a feature request github.com/ericvsmith/dataclasses/issues/139
– pylang
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382033%2fhow-can-i-show-the-code-that-is-generated-when-using-dataclass-class-decorator%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
There's no easy way. You may be interested in DataclassInspector, a project that tries to do exactly that. If you want to look at what the functions are actually doing, you can use
dis.dis
– Patrick Haugh
Nov 19 at 20:58
You can still inspect the generated signature:
str(inspect.signature(YourDataClass.__init__))
– x0s
2 days ago
I've submitted a feature request github.com/ericvsmith/dataclasses/issues/139
– pylang
yesterday