From: Diez B. R. <de...@we...> - 2003-10-29 13:43:00
|
Am Freitag, 10. Oktober 2003 01:54 schrieb Nicola de Candussio: > Hi all, > > is it possible to ovveride the and operator by implementing any specific > jyhton method ? > I would like to "and" boolean arrays and have returned the array of the > compared boolean elements but I could not find any documentation about it Radio eriwan says: It depends.... You can overload operators in classes like this: class Foo: def __and__(self, rightOp): ... return result However, this doesn't help when you work with built in types. Maybe you can create your own array-class, by overloading some other operators as well, but I'm currently not sure. If you'd provide some more details on what you want to do, I'd come up with a similar elegant solution, using some higher order functions. Regards, Diez |