¡@

Home 

python Programming Glossary: self._d

Python metaclasses: Why isn't __setattr__ called for attributes set during class definition?

http://stackoverflow.com/questions/10762088/python-metaclasses-why-isnt-setattr-called-for-attributes-set-during-class

MutableMapping def __init__ self args kwargs self._d dict args kwargs def __getitem__ self key return self._d key.. self._d dict args kwargs def __getitem__ self key return self._d key def __setitem__ self key value if key in self._d raise ValueError.. self._d key def __setitem__ self key value if key in self._d raise ValueError 'Key r already exists in SingleAssignDict'.format..

what would be a frozen dict?

http://stackoverflow.com/questions/2703599/what-would-be-a-frozen-dict

Don't forget the docstrings def __init__ self args kwargs self._d dict args kwargs self._hash None def __iter__ self return iter.. args kwargs self._hash None def __iter__ self return iter self._d def __len__ self return len self._d def __getitem__ self key.. self return iter self._d def __len__ self return len self._d def __getitem__ self key return self._d key def __hash__ self..