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

strip backend instances of setattr, more uses of cached_property for backend methods #1176

Closed
wants to merge 11 commits into from

Conversation

piotrbartman
Copy link
Collaborator

formulae or Storage should never be overridden

@slayoo slayoo changed the title Backend as strict class + minor changes strip backend instanes of setattr, more uses of cached_property for backend methods Oct 31, 2023
@slayoo slayoo changed the title strip backend instanes of setattr, more uses of cached_property for backend methods strip backend instances of setattr, more uses of cached_property for backend methods Oct 31, 2023
@slayoo
Copy link
Member

slayoo commented Nov 2, 2023

@piotrbartman, hopefully this PR finally achieves the intended "strict" behavior - formulae should not be alterable anymore neither in the backend, nor in particulator instances. Please have a look.

@slayoo
Copy link
Member

slayoo commented Nov 4, 2023

@abulenok, one more piece of rationale behind the non-pythonic removal of __setattr__ is that as a result the following typo-call causes an error (while without it, it passes silently producing no error and no effect):

backend.formulea = Formulae(constants={...})

(note the typo in property name)

@abulenok
Copy link
Collaborator

abulenok commented Nov 7, 2023

@abulenok, one more piece of rationale behind the non-pythonic removal of __setattr__ is that as a result the following typo-call causes an error (while without it, it passes silently producing no error and no effect):

backend.formulea = Formulae(constants={...})

(note the typo in property name)

@slayoo yeah, but this is true for any object in Python

@slayoo
Copy link
Member

slayoo commented Nov 7, 2023

@abulenok, one more piece of rationale behind the non-pythonic removal of __setattr__ is that as a result the following typo-call causes an error (while without it, it passes silently producing no error and no effect):

backend.formulea = Formulae(constants={...})

(note the typo in property name)

@slayoo yeah, but this is true for any object in Python

Indeed, which is why the pystrict package introduces @strict decorator (which we extensively use in the examples), and why Pylint would complain in such case

Copy link

github-actions bot commented Jan 7, 2024

Stale pull request message

@slayoo
Copy link
Member

slayoo commented Aug 1, 2024

closing this one in favour of a cleaner solution to be proposed and tracked at #1369

@slayoo slayoo closed this Aug 1, 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.

3 participants