sync from Atlas repo

This commit is contained in:
Luciano Ramalho
2014-11-14 12:03:10 -02:00
parent 661b68b235
commit 6dbc75520f
20 changed files with 2281 additions and 31 deletions

View File

@@ -201,12 +201,12 @@ class Vector:
shortcut_names = 'xyzt'
def __getattr__(self, name):
cls = type(self) # <1>
if len(name) == 1: # <2>
pos = cls.shortcut_names.find(name) # <3>
if 0 <= pos < len(self._components): # <4>
cls = type(self)
if len(name) == 1:
pos = cls.shortcut_names.find(name)
if 0 <= pos < len(self._components):
return self._components[pos]
msg = '{.__name__!r} object has no attribute {!r}' # <5>
msg = '{.__name__!r} object has no attribute {!r}'
raise AttributeError(msg.format(cls, name))
@classmethod