Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.

Add keyword-aliasing for underscores #13

Merged
merged 4 commits into from
Aug 17, 2014
Merged

Add keyword-aliasing for underscores #13

merged 4 commits into from
Aug 17, 2014

Conversation

hynek
Copy link
Owner

@hynek hynek commented Aug 7, 2014

This fixes #6 by stripping underscores from attributes for the initializer keyword-arguments.

It does it only for the new-style Attribute classes because I have the feeling that adding it retroactively to string-based ones would break backward-compatibility big time (I’ll happily listen to contrary opinions :))

What this does is basically the following:

@attributes([Attribute("_private")])
class C(object):
    pass

c = C(private=42)
assert c._private == 42

I would appreciate both feedback whether this is what you wanted and for a better name for keep_underscores because the name is gross. :|

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 7f777eb on private-attrs into 6ff5302 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 32f3158 on private-attrs into 6ff5302 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 9fbbb1e on private-attrs into 6ff5302 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling c072caf on private-attrs into 613f71c on master.

@hynek hynek added this to the 14.0 milestone Aug 9, 2014
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 6e307dc on private-attrs into 465d0e1 on master.

@hynek
Copy link
Owner Author

hynek commented Aug 17, 2014

Not waiting any further for feedback. If this is not what you wanted, re-open and comment on #6.

hynek added a commit that referenced this pull request Aug 17, 2014
Add keyword-aliasing for underscores

Fixes #6.
@hynek hynek merged commit adfd46e into master Aug 17, 2014
@hynek hynek deleted the private-attrs branch August 17, 2014 12:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow initialiser arguments to be mapped to alternative (private) attribute names
2 participants