[IronPython] Implicit Cast to Float
Michael Foord
fuzzyman at voidspace.org.uk
Fri Jun 22 01:41:22 CEST 2007
For the record - it *doesn't* implement IConvertible, so I can't use
that. I've searched the list and can find a very old discussion of
possible syntax - but no answer. :-(
Michael
Michael Foord wrote:
> Hello all,
>
> I am trying to use a data type that must be 'cast to a float' - the
> ZedGraph.XDate.
>
> It has what it calls an 'Implicit' operator:
>
> http://zedgraph.sourceforge.net/documentation/html/M_ZedGraph_XDate_op_Implicit_4.htm
>
> How can I get at this from IronPython? The obvious way doesn't seem to work:
>
> >>> from ZedGraph import XDate
> >>> d = XDate(2007, 1, 1)
> >>> float(d)
> Traceback (most recent call last):
> File , line 0, in <stdin>##25
> File , line 0, in Make##27
> AttributeError: 'XDate' object has no attribute '__float__'
>
> I need to add this to a collection and it needs to be as a float.
>
> The C# syntax to do this is:
>
> x = (double) new XDate( 1995, 5, i+11 );
>
> Any help appreciated!
>
> Thanks
>
> Michael Foord
> http://www.ironpython.info
>
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
More information about the Ironpython-users
mailing list