-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[internal] Using the Optional[] keyword in dataclasses #156
Comments
When if self.show_pincount is None:
self.show_pincount = self.style != 'simple' # hide pincount for simple (1 pin) connectors by default |
There are two different concepts:
Excerpt from the doc below: Optional type.
Note that this is not the same concept as an optional argument, which is one that has a default. An optional argument with a default does not require the
On the other hand, if an explicit value of
|
Should we start using type annotations in other code than |
Currently, some fields of the classes in
DataClasses.py
use theOptional[]
keyword, and some don't.I am unsure if there is a difference in behavior between both; or if the
= None
is needed at all.Boolean values should probably have a default value of
False
anyway, instead ofNone
.Perhaps someone can chime in and suggest which variant is recommended; then I can create a PR to make the syntax more consistent. Thanks!
The text was updated successfully, but these errors were encountered: