On Wed, Jun 20, 2012 at 12:38 PM, Maciej Fijalkowski <[email protected]>wrote:
> On Tue, Jun 19, 2012 at 9:18 PM, Костя Лопухин > <[email protected]>wrote: > >> 2012/6/19 Amaury Forgeot d'Arc <[email protected]>: >> > >> > Actually I think I found the cause: >> > bool.__format__ will correctly call format__Int_ANY(), >> > but the object is coerced into a int! >> > >> > Adding a format__Bool_ANY fixes the problem (with the same >> implementation)1 >> > but shouldn't we have W_BoolObject inherit from W_IntObject, >> > and remove delegate_Bool2IntObject? >> > >> >> I tried inheriting W_BoolObject from W_IntObject, removing >> delegate_Bool2IntObject and removing format__Bool_ANY - but then there >> is no format implementation for bool. And as I read in multimethod.py, >> it does not really interact with subclassing, so inheriting from >> W_IntObject will gain nothing here? >> Is it better to submit an easy fix first >> https://bitbucket.org/kostialopuhin/pypy-fix1180/compare/..pypy/pypy ? >> I just don't see what are the benefits of inhering from W_IntObject, >> cause I know too little yet) >> _______________________________________________ >> pypy-dev mailing list >> [email protected] >> http://mail.python.org/mailman/listinfo/pypy-dev >> > > bool inherits frmo int, just not W_BoolObject from W_IntObject. We should > and we should remove multimethods alltogether (they're a mess), but it's > quite a bit of effort. > > Cheers, > fijal > Ah and the reason why it would not work right now is because multimethods don't quite follow the typical inheritance chain. Cheers, fijal
_______________________________________________ pypy-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/pypy-dev
