Created
June 10, 2012 22:01
-
-
Save cnorthwood/2907477 to your computer and use it in GitHub Desktop.
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
>>> class IdentifierList(list): | |
... def by_namespace(self): | |
... return None | |
... | |
>>> class Locality(): | |
... @property | |
... def identifiers(self): | |
... return IdentifierList(self._identifiers) | |
... @identifiers.setter | |
... def identifiers(self, value): | |
... self._identifiers = value | |
... | |
>>> l = Locality() | |
>>> l.identifiers = ["hello"] | |
>>> l.identifiers | |
['hello'] | |
>>> l.identifiers.by_namespace | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'list' object has no attribute 'by_namespace' | |
>>> type(l.identifiers) | |
<type 'list'> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment