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

models allowing immutability #44

Merged
merged 7 commits into from Jun 13, 2017

Conversation

Projects
None yet
1 participant
@samuelcolvin
Copy link
Owner

samuelcolvin commented Jun 7, 2017

ref #38

This should also allow other cleanup including m.whatever = foobar updating __values__, it's also kind of necessary for #40 and copy(),

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.

@samuelcolvin samuelcolvin force-pushed the immutability branch 3 times, most recently from 18af130 to 129bd27 Jun 7, 2017

@samuelcolvin samuelcolvin force-pushed the immutability branch from daa8e5f to 73e802f Jun 12, 2017

@codecov

This comment has been minimized.

Copy link

codecov bot commented Jun 12, 2017

Codecov Report

Merging #44 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master    #44   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10     10           
  Lines         701    691   -10     
  Branches      156    155    -1     
=====================================
- Hits          701    691   -10

@samuelcolvin samuelcolvin force-pushed the immutability branch from 0a0b993 to 29ec2d9 Jun 12, 2017

@samuelcolvin

This comment has been minimized.

Copy link
Owner Author

samuelcolvin commented Jun 12, 2017

ready

@samuelcolvin samuelcolvin changed the title WIP: models allowing immutability models allowing immutability Jun 12, 2017

@samuelcolvin samuelcolvin force-pushed the immutability branch from 29ec2d9 to dd8db9b 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

This comment has been minimized.

@samuelcolvin

samuelcolvin Jun 12, 2017

Author Owner

Typo

self.__values__[field] = value
setattr(self, field, value)
value = input_data[field]
values[field] = value

This comment has been minimized.

@samuelcolvin

samuelcolvin Jun 12, 2017

Author Owner

One line

@samuelcolvin samuelcolvin merged commit 6923e5e into master Jun 13, 2017

4 checks passed

codecov/project 100% (+0%) compared to 8364a6b
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
pyup.io/safety-ci No dependencies with known security vulnerabilities.
Details

@samuelcolvin samuelcolvin deleted the immutability branch Jun 13, 2017

@samuelcolvin samuelcolvin referenced this pull request Jun 21, 2017

Merged

Immutability part 2 #53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.