-
Notifications
You must be signed in to change notification settings - Fork 146
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
Remove attribute from PClass sets attribute to initial value #76
Comments
Thanks for finding this inconsistency. Perhaps the best long term solution would be to rename Don't know if you have any thoughts on this? |
I like the idea to rename the current PClass behaviour as Eventually, following deprecation and based on demand, On initialization, the sequence would be as if:
The On
|
Yes, something like that but I think that one of |
No, I don't have a use case. The current different behavior for PRecord's and PClass's seems sensible, since a Python class behaves the same way as a PClass. However, the use of the |
PClass
is documented as behaving likePRecord
(except that it is not a collection).However, there is a difference in the behaviour when removing attributes.
Removing an attribute from a
PRecord
either deletes the attribute, or, if the field is mandatory, fails with anInvariantException
.Performing the equivalent operations on a
PClass
returns the attribute to the initial value, whether the attribute is mandatory or not.Changing the behaviour to be more consistent would be a major backwards-incompatible change, so the initial fix might update the docs for
PClass
to describe this additional difference.The text was updated successfully, but these errors were encountered: