GeezerVison is showing github.com — use __call__ for features to make it more explicit, remove all repr by kushalkolar · Pull Request #92 · fastplotlib/fastplotlib
Conversation
kushalkolar
commented
Dec 28, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
implements #91
example before:
# to access the actual data
line.colors.feature_data
# this would return a string of the data, because of repr
# but could be confusing and user could thing this returns the actual data
line.colors
# prints the cmap name as a str
image.cmap
# gives the pygfx Texture buffer data, I think?
image.cmap.feature_data
this PR:
# to access the actual data
line.colors()
# this just prints the class name and memory location, default repr
line.colors
# prints class name and memory location
image.cmap
# prints the cmap name
image.cmap.name
# access to the data buffer
image.cmap()
Example where the "before" way could be confusing:
# set line feature from another line
# a user might thing this is possible because the repr returns the data
this_line.colors = other_line.colors
# correct way
this_line.colors = other_line.colors.feature_data
This PR, GraphicFeature._parse_set_value() can be used to do the call before setting the value in any subclass _set() implementation.
# correct way
this_line.colors = other_line.colors
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.