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

ENH: Improvements to attributeSetter decorator #6396

Closed
wants to merge 14 commits into from

Conversation

TEParsons
Copy link
Contributor

Intention being to make it easier for plugin developers to use.

  • Adding an attributeSetter attribute now automatically creates setWhatever/getWhatever functions, reducing setWhatever is not defined errors coming out of Builder because xyz developer forgot to create that function
  • Querying the value of an attributeSetter attribute before it's been set will now return the decorated function's default value rather than the getattribute method handle, making error messages much clearer and reducing the chance of getting attributeSetter has no attribute xyz because you forgot to set something in init
  • While I was in the neighbourhood I expanded the documentation to help see how to use it

Tested the speed and it doesn't seem any slower, which makes sense as there's not really any extra overhead once the attribute is set once - the only things which take any time are setting the get/set methods (which only happens once, on class import) and generating the method sig to get default (which only happens if the value hasn't been set)

@TEParsons TEParsons marked this pull request as draft April 19, 2024 08:53
Copy link
Member

@peircej peircej left a comment

Choose a reason for hiding this comment

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

This has many (working) lines changed and may be producing errors. The changes don't seem useful to users. So to the user, it feels like this PR is a net loss - more potential bugs and no benefits

@peircej
Copy link
Member

peircej commented Apr 24, 2024

Closing, This is a substantial refactor. I'm not clear that it's necessary and has a high likelihood of introducing bugs and behaviour changes that we aren't yet aware of. It certainly isn't a priority issue for users to have changed. Let's focus on what the users need fixing

@peircej peircej closed this Apr 24, 2024
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.

None yet

2 participants