Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better do rename it inside
_callback.py
, otherwise there might be situations where the same thing shows up as either name. I wouldn't consider that a breaking change, this hasn't ever been part of the exposed API.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KoolADE85 brought up this point as well.
Compare:
whereas with
None
, it'sSo we should expect (I'm pretty sure):
Which requires renaming the
NoUpdate
class.We'll want this
type
to be discoverable & renaming rather than aliasing enables that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather it not be postfixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@T4rk1n how come?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we have here is not a type but a class. Since everything is a class in Python it feel meaningless to have a postfix of
Type
which it is not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main goal here is just to ensure users always use the instance rather than the class in their callbacks. If we were to expose both
dash.no_update
anddash.NoUpdate
, then someone looking atdir(dash)
could easily choose the wrong one. But if we havedash.NoUpdateType
instead it would be clear not to use that one.To my mind type vs class is a minor distinction, particularly since as @ndrezn points out the
type()
function returns the class your object is an instance of, and it fits the pattern ofNone
/NoneType
. But if you want to do something else to distinguish theno_update
instance from its class that's fine by me, so long as whatever we do makes it clear not to use the class.