yeah, either something like that, or let RowProxy.__hash__ be 
hash(tuple(theRowProxy)) as IMO RowProxy has same meaning as tuple: 
readonly-row-ordered-in-constant-way

On Friday 09 January 2009 12:03:52 King Simon-NFHD78 wrote:
> > -----Original Message-----
> > From: sqlalchemy@googlegroups.com
> > [mailto:sqlalch...@googlegroups.com] On Behalf Of
> > a...@svilendobrev.com Sent: 08 January 2009 19:11
> > To: sqlalchemy@googlegroups.com
> > Subject: [sqlalchemy] Re: SQLAlchemy 0.5 Released
> >
> > On Thursday 08 January 2009 21:03:42 Michael Bayer wrote:
> > > On Jan 8, 2009, at 12:52 PM, a...@svilendobrev.com wrote:
> > > > instead of None, better do some empty method raising some
> > > > error, because in the current way the error comes up in not
> > > > at all obvious fashion, takes quite some head-scratching to
> > > > find-out - there's no mentioning of anything set() related
> > > > there.
> > >
> > > __hash__ = None means no hash is defined.  Its in the Python
> > > docs.
> >
> > okay, have fun with
> > TypeError: 'NoneType' object is not callable
>
> http://docs.python.org/reference/datamodel.html#object.__hash__
> implies that "__hash__ = None" only took on that special meaning in
> Python 2.6
>
> In Python 2.5, I think you're probably supposed to explicitly raise
> a TypeError, but in Python 2.6 that would cause isinstance(obj,
> collections.Hashable) to give the wrong answer. Maybe you could do
> something like this:
>
> #------------------------------------------------------------------
>-- 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.
>
> Simon
>
> 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to