Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify function args to use default rather than being None #1595

Closed

Conversation

LucienMorey
Copy link
Contributor

Pretty benign change, but I noticed it when I was doing docs for everything, and it's been a brain worm since...

@LucienMorey LucienMorey requested a review from a team as a code owner November 19, 2024 23:56
self, result: PhotonPipelineResult, receiveTimestamp: float | None
self,
result: PhotonPipelineResult,
receiveTimestamp: float = wpilib.Timer.getFPGATimestamp() * 1e6,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does this default get evaluated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I dont think there is a solution to this without drastically changing the typings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check if none and then default to getFpgaTimestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats basically what it is right now without screwing with the type signature of the function to make it do funny things. The intent of this was to remove optional typing from the signature and if that cant be sorted I don't think this is worth worrying about

@LucienMorey LucienMorey deleted the tidy_default_arg branch November 20, 2024 10:28
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.

3 participants