Skip to content

Default Int vs. Default Float - #1608

Open
McNeight wants to merge 1 commit into
kk7ds:masterfrom
McNeight:default_float
Open

McNeight wants to merge 1 commit into
kk7ds:masterfrom
McNeight:default_float

Conversation

@McNeight

Copy link
Copy Markdown
Contributor

Setting a default value for watts and dBm as an integer instead of a float means that linters such as Pylance in VSCode will display an error: Argument of type "float" cannot be assigned to parameter "watts" of type "int" in function "init"
  "float" is not assignable to "int"

This error appears in every single driver that uses a floating point value for power.

Changing the default value from "0" to "0.0" means that both watts and dBm will get treated as a floating point value at all times.

Setting a default value for watts and dBm as an integer instead of a float
means that linters such as Pylance in VSCode will display an error:
Argument of type "float" cannot be assigned to parameter "watts" of type "int" in function "__init__"
  "float" is not assignable to "int"

This error appears in every single driver that uses a floating point
value for power.

Changing the default value from "0" to "0.0" means that both watts and dBm
will get treated as a floating point value at all times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant