Make the landmark manager an attr dict#1
Open
patricksnape wants to merge 1 commit intolabelled_pointgraphfrom
Open
Make the landmark manager an attr dict#1patricksnape wants to merge 1 commit intolabelled_pointgraphfrom
patricksnape wants to merge 1 commit intolabelled_pointgraphfrom
Conversation
This is a special kind of mutable mapping that exposes it's keys as attributes. Uses the correct overriding of __getattr__ and __setattr_ in order to not override the default behaviour of the attributes actually on the class (inspired by Bunch and used under the MIT license: https://github.com/dsc/bunch/blob/master/LICENSE.txt). This also makes a stronger enforcement of ascii style string identifiers only for Python 2 and Unicode identifiers for Python 3.
patricksnape
commented
Feb 6, 2017
| man = LandmarkManager() | ||
| man['test_set'] = pcloud.copy() | ||
| man['abc'] = pcloud.copy() | ||
| man['def'] = pcloud.copy() |
Owner
Author
There was a problem hiding this comment.
@jabooth Hilariously this fails as a key because def is a reserved keyword
Collaborator
Collaborator
There was a problem hiding this comment.
@patricksnape (I'll be honest, before trying that I actually thought the first two might succeed, as I'd seen the latter example work before. But, (obviously, in retrospect) __builtin__ != keyword)
This file contains hidden or 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
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.

An example usage is:
@jabooth @nontas @grigorisg9gr What do you think? Obviously requires menpo#675 first