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

Support keyword argument initialization of Structures #43

Merged
merged 3 commits into from
Oct 9, 2016
Merged

Support keyword argument initialization of Structures #43

merged 3 commits into from
Oct 9, 2016

Conversation

rtzoeller
Copy link
Contributor

Adds support for initializing structures via keyword argument, as described in #40.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 98.59% when pulling 27e355c on rtzoeller:attribute_assignment into 1912bca on digidotcom:master.

@posborne
Copy link
Contributor

posborne commented Oct 7, 2016

Looks like there is a conflict now, so probably rebase on master. Change looks good overall, however, so I'll be happy to merge once rebased.

@@ -278,6 +298,8 @@ def __init__(self):
self._placeholder_to_field[field_placeholder] = field
self._sorted_fields.append((key, field))
self._packer = Packer(self._sorted_fields, self._crc_field)
for key, value in kwargs.items():
self.__setattr__(key, value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idiomatically, better written as setattr(self, key, value).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 98.596% when pulling 933fd67 on rtzoeller:attribute_assignment into 081c93d on digidotcom:master.

@posborne posborne merged commit c372708 into digidotcom:master Oct 9, 2016
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.

None yet

3 participants