Project

General

Profile

« Previous | Next » 

Revision 2375

util.py: NamedTuple inherits from objects.BasicObject so that it's comparable and hashable. This fixes a bug in dicts.make_hashable() where the NamedTuple created for a dict would appear to be hashable but would always compare as unequal.

View differences:

lib/util.py
1 1
# Useful functions and classes
2 2

  
3
import objects
4

  
3 5
import collections
4 6

  
5 7
#### Function wrappers for statements
......
210 212

  
211 213
#### Named tuples
212 214

  
213
class NamedTuple:
215
class NamedTuple(objects.BasicObject):
214 216
    def __init__(self, **attrs): self.__dict__ = attrs
215 217
    
216 218
    def __iter__(self): return iter(self.__dict__)

Also available in: Unified diff