Re: __getattribute__ for operators

2009-04-18 Thread Piet van Oostrum
> Michael (M) wrote: >M> While thinking about Steven D'Aprano's thread about automatically >M> generating arithmetic operations for a subclass, I stumbled upon >M> something confusing. Having defined the following class to do funky >M> addition, >M> class MyInt(int): >M> def __getattrib

Re: __getattribute__ for operators

2009-04-18 Thread Terry Reedy
Michael wrote: While thinking about Steven D'Aprano's thread about automatically generating arithmetic operations for a subclass, I stumbled upon something confusing. Having defined the following class to do funky addition, class MyInt(int): def __getattribute__(self, key): if key =

Re: __getattribute__ for operators

2009-04-18 Thread Michael
Hmm... I meant to create a new thread, as does GMail when you edit the subject. Pardon my Google-Groups newbieness. - Michael -- http://mail.python.org/mailman/listinfo/python-list

__getattribute__ for operators

2009-04-18 Thread Michael
While thinking about Steven D'Aprano's thread about automatically generating arithmetic operations for a subclass, I stumbled upon something confusing. Having defined the following class to do funky addition, class MyInt(int): def __getattribute__(self, key): if key == "__add__":