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

Deprecate isinstance and function identity checks #16

Open
dwf opened this issue May 28, 2014 · 0 comments
Open

Deprecate isinstance and function identity checks #16

dwf opened this issue May 28, 2014 · 0 comments

Comments

@dwf
Copy link
Contributor

dwf commented May 28, 2014

Writing this down so I don't forget.

One of the goals is to be able to distribute partialplus.py with your project and have it interoperate with other projects that bundle partialplus.py (or searchspaces). To save ourselves computation and headaches, we need a way of checking that objects are PartialPlus objects (or special functions defined by partialplus as node markers) without using isinstance/equality checks on functions.

The plan:

  • Add a class-level _partialplus_version_ attribute to Node.
  • For make_* and *_node functions, add a decorator @annotate_version that adds a 'partialplus_version' attribute, equal to partialplus's __version__.
  • All the is_* functions should then check the function's name attribute and the _partialplus_version_ attribute (there should be a separate function that checks that __version__ is greater than or equal to the node's _partialplus_version_).
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

No branches or pull requests

1 participant