On Fri, Feb 24, 2012 at 10:54 AM, Cesar Mello <cme...@gmail.com> wrote: > Is there a way to satisfy both scenarios? So that the object could also be > evaluated implicitly as a float? > > My first thought was to use a coercion, but the documentation does not > recommend it. Any other suggestions please?
You didn't specify if the objects are Python or C#, but I'm assuming C#. You'll need to overload + - * / on the objects to behave as you want, to cover basic math, and add an impilcit conversion to float ('implicit operator float()' in C#, __float__ in Python) if they decide to call sqrt() or similar. I'm assuming IronPython will handle the conversions properly; if not, file a bug because it's a pretty big problem if it doesn't. - Jeff _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org http://mail.python.org/mailman/listinfo/ironpython-users