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
models allowing immutability #44
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samuelcolvin
force-pushed
the
immutability
branch
3 times, most recently
from
June 10, 2017 17:11
18af130
to
129bd27
Compare
samuelcolvin
force-pushed
the
immutability
branch
from
June 12, 2017 18:03
daa8e5f
to
73e802f
Compare
Codecov Report
@@ Coverage Diff @@
## master #44 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 10 10
Lines 701 691 -10
Branches 156 155 -1
=====================================
- Hits 701 691 -10 |
samuelcolvin
force-pushed
the
immutability
branch
from
June 12, 2017 19:23
0a0b993
to
29ec2d9
Compare
ready |
samuelcolvin
changed the title
WIP: models allowing immutability
models allowing immutability
Jun 12, 2017
samuelcolvin
force-pushed
the
immutability
branch
from
June 12, 2017 19:34
29ec2d9
to
dd8db9b
Compare
samuelcolvin
commented
Jun 12, 2017
HISTORY.rst
Outdated
v0.3.0 (TBC) | ||
............ | ||
* immutable models via ``config.allow_mutation = False``, associated cleanup and performance improvement #44 | ||
* ``setatt`` is removed as ``__setattr__`` is not intelligent #44 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
pydantic/main.py
Outdated
self.__values__[field] = value | ||
setattr(self, field, value) | ||
value = input_data[field] | ||
values[field] = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One line
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ref #38
This should also allow other cleanup including
m.whatever = foobar
updating__values__
, it's also kind of necessary for #40 andcopy()
,This also gives a slight (5 - 10%) performance increase instead of 10% decrease as the previous
__setattr__
approach did.It should also decrease memory footprint as
__slots__
is used and__values__
is no longer duplicated.