Skip to content

Commit

Permalink
actually match the old C behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed May 4, 2013
1 parent d5cd0e8 commit dd4ad12
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Record/__init__.py
Expand Up @@ -52,20 +52,15 @@ def __getitem__(self, key):
if isinstance(key, int):
pos = key
else:
try:
pos = self._schema[key]
except IndexError:
raise TypeError('invalid record schema')
pos = self._schema[key]
return self._data[pos]

def __getattr__(self, key, default=_marker):
def __getattr__(self, key):
if key in self.__slots__:
return object.__getattribute__(self, key)
try:
return self.__getitem__(key)
except KeyError:
if default is not _marker:
return default
raise AttributeError(key)

def __setitem__(self, key, value):
Expand Down

0 comments on commit dd4ad12

Please sign in to comment.