Re: New+old-style multiple inheritance

2007-12-20 Thread Robert Kern
Bruno Desthuilliers wrote: > Jonathan Gardner a écrit : >> On Dec 18, 7:08 am, "[EMAIL PROTECTED]" > (snip) >> Monkey patching is definitely unpythonic. You must be a Ruby guy. > > Strange enough, I learned monkey-patching with Python, years before I > first heard of a language named Ruby. Inde

Re: New+old-style multiple inheritance

2007-12-20 Thread Bruno Desthuilliers
Jonathan Gardner a écrit : > On Dec 18, 7:08 am, "[EMAIL PROTECTED]" (snip) > Monkey patching is definitely unpythonic. You must be a Ruby guy. Strange enough, I learned monkey-patching with Python, years before I first heard of a language named Ruby. > Why > don't you try doing something else

Re: New+old-style multiple inheritance

2007-12-19 Thread George Sakkis
On Dec 19, 12:01 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > They should have converted the > old-style to new when they decided to derive from both types (it's not > like that's terribly difficult). Unless perhaps the old-style class is part of an stdlib or 3rd party (or rather 4th party since

Re: New+old-style multiple inheritance

2007-12-19 Thread Carl Banks
On Dec 19, 10:55 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Dec 18, 3:16 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > > On Dec 18, 10:08 am, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > We are trying to monkey-patch a third-party library that mixes new and > > > old-style clas

Re: New+old-style multiple inheritance

2007-12-19 Thread George Sakkis
On Dec 18, 3:16 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 18, 10:08 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > We are trying to monkey-patch a third-party library that mixes new and > > old-style classes with multiple inheritance. > > New library? Geez, if people are dumb

Re: New+old-style multiple inheritance

2007-12-18 Thread Michele Simionato
On Dec 18, 9:25 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > A well-considered, timely monkey-patch can sometimes save all kinds of > workarounds and other headaches. > > Carl Banks +1 Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: New+old-style multiple inheritance

2007-12-18 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Thank Gabriel, | | That sounds exactly right and your work-around provides confirmation. | This code is an expedient solution for us so I expect we'll go with | forcing a slot update. Hopefully the library concerned is going to | fix

Re: New+old-style multiple inheritance

2007-12-18 Thread [EMAIL PROTECTED]
ot; > > else: > > print "false" > > > > > Produces this output: > > > doing the test on Baz(Foo,Bar). Should return false > > true > > > With some experimentation it is clear that this behaviour only occurs > > when you com

Re: New+old-style multiple inheritance

2007-12-18 Thread [EMAIL PROTECTED]
On Dec 18, 8:25 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 18, 2:09 pm, Jonathan Gardner > > > > <[EMAIL PROTECTED]> wrote: > > On Dec 18, 7:08 am, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > We are trying to monkey-patch a third-party library that mixes new and > > > old-sty

Re: New+old-style multiple inheritance

2007-12-18 Thread Carl Banks
On Dec 18, 2:09 pm, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On Dec 18, 7:08 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > We are trying to monkey-patch a third-party library that mixes new and > > old-style classes with multiple inheritance. In so doing we have > > uncovered som

Re: New+old-style multiple inheritance

2007-12-18 Thread Carl Banks
On Dec 18, 10:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > We are trying to monkey-patch a third-party library that mixes new and > old-style classes with multiple inheritance. New library? Geez, if people are dumb enough to do this, are you sure you want your application to depend on

Re: New+old-style multiple inheritance

2007-12-18 Thread Gabriel Genellina
az() > > print "doing the test on Baz(Foo,Bar). Should return false" > if b: > print "true" > else: > print "false" > > > Produces this output: > > doing the test on Baz(Foo,Bar). Should return false > true > > W

Re: New+old-style multiple inheritance

2007-12-18 Thread Jonathan Gardner
On Dec 18, 7:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > We are trying to monkey-patch a third-party library that mixes new and > old-style classes with multiple inheritance. In so doing we have > uncovered some unexpected behaviour: > > > I know this level of messing with python inte

New+old-style multiple inheritance

2007-12-18 Thread [EMAIL PROTECTED]
st on Baz(Foo,Bar). Should return false true With some experimentation it is clear that this behaviour only occurs when you combine new+old-style multiple inheritance, monkey-patching and special methods. If Foo and Bar are either old or new-style it works. calling b.__nonzero__() directly works