On Jan 9, 2009, at 5:03 AM, King Simon-NFHD78 wrote: > #-------------------------------------------------------------------- > import sys > > if sys.version_info < (2, 6): > def unhashable(self): > raise TypeError('%s objects are not hashable' % > type(self).__name__) > else: > unhashable = None > > > def test(): > print "Testing on Python version %s" % (sys.version_info,) > class Dummy(object): > __hash__ = unhashable > > dummy = Dummy() > > try: > print "FAIL: hash(dummy) = %s" % hash(dummy) > except TypeError, e: > print "PASS: %s" % e > > if sys.version_info >= (2, 6): > import collections > if isinstance(dummy, collections.Hashable): > print "FAIL: isinstance(dummy, collections.Hashable) -> > True" > else: > print "PASS: isinstance(dummy, collections.Hashable) -> > False" > > if __name__ == '__main__': > test() > > #-------------------------------------------------------------------- > > That basic test seems to work on Python 2.4, 2.5 and 2.6. >
yeah that's what i was thinking. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---