Re: Python 2.6: Determining if a method is inherited

2008-10-07 Thread Fuzzyman
On Oct 7, 2:29 am, Terry Reedy <[EMAIL PROTECTED]> wrote: > Fuzzyman wrote: > > On Oct 6, 7:02 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > >> fuzzyman wrote: > >>> Doesn't sound like a particularly *good* solution to me. :-) > >>  From what you posted, 'type object at' should work. > > > It's stil

Re: Python 2.6: Determining if a method is inherited

2008-10-06 Thread Terry Reedy
Fuzzyman wrote: On Oct 6, 7:02 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: fuzzyman wrote: Doesn't sound like a particularly *good* solution to me. :-) From what you posted, 'type object at' should work. It's still a hack... I am sorry if I offended you by pointing out to you a quick and d

Re: Python 2.6: Determining if a method is inherited

2008-10-06 Thread Fuzzyman
On Oct 6, 7:02 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Fuzzyman wrote: > > On Oct 5, 11:54 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > >> Fuzzyman wrote: > >>> Hello all, > >>> I may well be being dumb (it has happened before), but I'm struggling > >>> to fix some code breakage with Python 2.

Re: Python 2.6: Determining if a method is inherited

2008-10-06 Thread Terry Reedy
Fuzzyman wrote: On Oct 5, 11:54 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: Fuzzyman wrote: Hello all, I may well be being dumb (it has happened before), but I'm struggling to fix some code breakage with Python 2.6. I have some code that looks for the '__lt__' method on a class: if hasattr(clr,

Re: Python 2.6: Determining if a method is inherited

2008-10-06 Thread Fuzzyman
On Oct 6, 7:16 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > In 3.0, the test returns true because function attributes only get > > wrapped when bound. In the meanwhile, " 'object' in repr(X.__lt__)" > > should do it for you. > > This session should give you some hints h

Re: Python 2.6: Determining if a method is inherited

2008-10-06 Thread Fuzzyman
On Oct 5, 11:54 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Fuzzyman wrote: > > Hello all, > > > I may well be being dumb (it has happened before), but I'm struggling > > to fix some code breakage with Python 2.6. > > > I have some code that looks for the '__lt__' method on a class: > > > if hasat

Re: Python 2.6: Determining if a method is inherited

2008-10-05 Thread Christian Heimes
Terry Reedy wrote: In 3.0, the test returns true because function attributes only get wrapped when bound. In the meanwhile, " 'object' in repr(X.__lt__)" should do it for you. This session should give you some hints how to archive your goal :) Have fun! >>> import types >>> class A(object):

Re: Python 2.6: Determining if a method is inherited

2008-10-05 Thread Terry Reedy
Fuzzyman wrote: Hello all, I may well be being dumb (it has happened before), but I'm struggling to fix some code breakage with Python 2.6. I have some code that looks for the '__lt__' method on a class: if hasattr(clr, '__lt__'): However - in Python 2.6 object has grown a default implementat

Re: Python 2.6: Determining if a method is inherited

2008-10-05 Thread Fuzzyman
On Oct 5, 8:15 pm, [EMAIL PROTECTED] (Valentino Volonghi aka Dialtone) wrote: > Fuzzyman <[EMAIL PROTECTED]> wrote: > > So how do I tell if the X.__lt__ is inherited from object? I can look > > I don't have python 2.6 installed so I can't try but what I think could > work is: > > >>> class Foo(obje

Re: Python 2.6: Determining if a method is inherited

2008-10-05 Thread Aaron "Castironpi" Brady
Fuzzyman wrote: Hello all, I may well be being dumb (it has happened before), but I'm struggling to fix some code breakage with Python 2.6. I have some code that looks for the '__lt__' method on a class: if hasattr(clr, '__lt__'): However - in Python 2.6 object has grown a default implementat

Re: Python 2.6: Determining if a method is inherited

2008-10-05 Thread Valentino Volonghi aka Dialtone
Fuzzyman <[EMAIL PROTECTED]> wrote: > So how do I tell if the X.__lt__ is inherited from object? I can look I don't have python 2.6 installed so I can't try but what I think could work is: >>> class Foo(object): ... def hello(self): ... pass ... >>> class Bla(Foo): ... def hello

Python 2.6: Determining if a method is inherited

2008-10-05 Thread Fuzzyman
Hello all, I may well be being dumb (it has happened before), but I'm struggling to fix some code breakage with Python 2.6. I have some code that looks for the '__lt__' method on a class: if hasattr(clr, '__lt__'): However - in Python 2.6 object has grown a default implementation of '__lt__', s