[Sqlalchemy-tickets] Issue #3012: can't overrride __and__(), __or__() (and __invert__()?) (zzzeek/s
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2014-03-31 14:43:38
|
New issue 3012: can't overrride __and__(), __or__() (and __invert__()?) https://bitbucket.org/zzzeek/sqlalchemy/issue/3012/cant-overrride-__and__-__or__-and Mike Bayer: ``` #!python from sqlalchemy import Integer, TypeDecorator, Column, type_coerce class Foo(TypeDecorator): impl = Integer class comparator_factory(TypeDecorator.Comparator): def __eq__(self, other): print "EQ!" return type_coerce(self.expr, Integer) == other def __and__(self, other): print "AND!" return type_coerce(self.expr, Integer) & other c = Column('x', Foo()) print c == 5 print c & 2 ``` |