Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Pekka Laukkanen
2008/10/7 Pekka Laukkanen <[EMAIL PROTECTED]>: > 2008/10/5 Fuzzyman <[EMAIL PROTECTED]>: >> 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 / 3.0: Determining if a method is inherited

2008-10-06 Thread Pekka Laukkanen
2008/10/5 Fuzzyman <[EMAIL PROTECTED]>: > 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 grow

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Fuzzyman
On Oct 6, 7:23 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Oct 6, 1:17 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > On Oct 6, 7:01 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> > > wrote: > > > It's a very object oriented solution.  Essentially you're inheriting > >

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Aaron "Castironpi" Brady
On Oct 6, 1:17 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Oct 6, 7:01 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> > wrote: > > It's a very object oriented solution.  Essentially you're inheriting > > all the classes that you want to fail, from a class that does. > > But not a very good s

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Fuzzyman
On Oct 6, 7:01 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Oct 6, 4:30 am, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > > > On Oct 6, 1:13 am, MRAB <[EMAIL PROTECTED]> wrote: > > > > Fuzzyman wrote: > > > > Hello all, > > > > > I may well be being dumb (it has happened before), bu

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Aaron "Castironpi" Brady
On Oct 6, 4:30 am, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Oct 6, 1:13 am, MRAB <[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 c

Re: Python 2.6 / 3.0: Determining if a method is inherited

2008-10-06 Thread Fuzzyman
On Oct 6, 1:13 am, MRAB <[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 / 3.0: Determining if a method is inherited

2008-10-05 Thread Aaron "Castironpi" Brady
On Oct 5, 7:13 pm, MRAB <[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 / 3.0: Determining if a method is inherited

2008-10-05 Thread MRAB
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 defau

Python 2.6 / 3.0: Determining if a method is inherited (Fixed)

2008-10-05 Thread Fuzzyman
Hello all, Sorry - my messages aren't showing up via google groups, so I'm kind of posting on faith... Anyway, I solved my problem (I think)... import sys if sys.version_info[0] == 3: def _has_method(cls, name): for B in cls.__mro__: if B is object: conti

Python 2.6 / 3.0: 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