Mixing Decimal and float

B.V. bv.tryton at gmail.com
Fri Jun 4 03:20:05 EDT 2010


On Jun 3, 2:00 am, Chris Rebert <c... at rebertia.com> wrote:
> On Wed, Jun 2, 2010 at 4:11 PM, Steven D'Aprano
>
> <steve-REMOVE-T... at cybersource.com.au> wrote:
> > On Wed, 02 Jun 2010 17:17:11 -0400, Nathan Rice wrote:
> >> My apologies if someone already mentioned this and I missed it but...
>
> >> class.__instancecheck__(self, instance) - Return true if instance should
> >> be considered a (direct or indirect) instance of class. If defined,
> >> called to implement isinstance(instance, class).
>
> >> class.__subclasscheck__(self, subclass) - Return true if subclass should
> >> be considered a (direct or indirect) subclass of class. If defined,
> >> called to implement issubclass(subclass, class).
>
> > The original poster needs to support Python 2.5 and 2.6, but
> > __instancecheck__ and __subclasscheck__ are only supported in 2.6 or
> > higher, so this doesn't help.
>
> Even in 2.6+, good luck trying to define new methods on class `type`
> (the metaclass of float and Decimal).
>
> Cheers,
> Chris
> --http://blog.rebertia.com

You mean it! I have spent two hours trying it, with no success. I
think we manage to find another solution to our problem.
Thank you for helping.

B.



More information about the Python-list mailing list