GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@kushalkolar kushalkolar commented Dec 28, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions
kushalkolar added 2 commits December 28, 2022 11:26
@kushalkolar
use __call__ for features to make it more explicit, remove all repr
07d15ec
@kushalkolar
we can actually allow direct setting of features from another feature
a13da44
@kushalkolar kushalkolar mentioned this pull request Dec 29, 2022
We should use __call__ on graphic feature to get the actual data #91
Closed
@kushalkolar
Merge branch 'master' into feature-call
731a067
@kushalkolar
kushalkolar merged commit c99bf2b into master Dec 29, 2022
@kushalkolar
kushalkolar deleted the feature-call branch January 7, 2023 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

1 participant

@kushalkolar
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.