Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-02 Thread Cesar Mello
Hey thanks so much for the great help! It worked perfectly. Thanks! Best regards!!! Mello On Fri, Mar 2, 2012 at 1:24 PM, Jeff Hardy wrote: > On Fri, Mar 2, 2012 at 4:42 AM, Cesar Mello wrote: > > Hi! > > > > Is it possible for a .NET class to provide a property with the Python > > datetime

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-02 Thread Jeff Hardy
On Fri, Mar 2, 2012 at 4:42 AM, Cesar Mello wrote: > Hi! > > Is it possible for a .NET class to provide a property with the Python > datetime instead of System.DateTime? Yep - just use PythonDateTime.datetime, in the IronPython.Modules namespace. - Jeff > > Thank you very much for the attention

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-02 Thread Cesar Mello
Hi! Is it possible for a .NET class to provide a property with the Python datetime instead of System.DateTime? Thank you very much for the attention! Best regards! Mello On Thu, Mar 1, 2012 at 6:31 PM, Cesar Mello wrote: > It worked perfectly and fast! Thank you so much > > Best regards

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Dino Viehland
[email protected]] On > Behalf Of Jeff Hardy > Sent: Thursday, March 01, 2012 12:38 PM > To: Cesar Mello > Cc: [email protected] > Subject: Re: [Ironpython-users] Implicit conversion of objects to float > > On Thu, Mar 1, 2012 at 12:13 PM, Cesar Mello w

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Cesar Mello
It worked perfectly and fast! Thank you so much Best regards Mello On Thu, Mar 1, 2012 at 5:37 PM, Jeff Hardy wrote: > On Thu, Mar 1, 2012 at 12:13 PM, Cesar Mello wrote: > > Hey guys! > > > > Just curious: is there a way to implement in the .NET class something > that > > maps to the ** o

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Jeff Hardy
On Thu, Mar 1, 2012 at 12:13 PM, Cesar Mello wrote: > Hey guys! > > Just curious: is there a way to implement in the .NET class something that > maps to the ** operator? You should be able to create a method called __pow__ like so: public object __pow__(object b, object e) { ... } Replace ob

Re: [Ironpython-users] Implicit conversion of objects to float

2012-03-01 Thread Cesar Mello
Hey guys! Just curious: is there a way to implement in the .NET class something that maps to the ** operator? I've tried the other way: calling into a Python function that works as a factory of proxy objects. These proxies overload the arithmetic operators and delegates everything to the real (.N

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-27 Thread Vernon Cole
On Mon, Feb 27, 2012 at 9:20 AM, Jeff Hardy wrote: > ... > I added conversions from System.Decimal to decimal.Decimal in > 2.7.2, but I didn't think about implicit conversions of other types. > I'm thinking now that anything that's either a System.Decimal or > implicitly convertible to System.D

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-27 Thread Jeff Hardy
> On Fri, Feb 24, 2012 at 7:50 PM, Cesar Mello wrote: > I agree it may be error-prone. But there are valid scenarios where it is not. > Although implementing the arithmetic overloads allow me to mix DataValues and > floats in the same expressions, I am not able to initialize a Python's > Decima

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-27 Thread Markus Schaber
[email protected] [mailto:[email protected]] Im Auftrag von Cesar Mello Gesendet: Samstag, 25. Februar 2012 17:25 An: Jeff Hardy Cc: [email protected] Betreff: Re: [Ironpython-users] Implicit conversion of objects to float Hi, Although impleme

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-27 Thread Markus Schaber
hon.org Betreff: Re: [Ironpython-users] Implicit conversion of objects to float Hi, Although implementing the arithmetic operator overloads solve my problem, I am still curious if there is a way to implement the implicit conversion in Python, much like the sample C# program below does. This is a

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-25 Thread Cesar Mello
Hi, Although implementing the arithmetic operator overloads solve my problem, I am still curious if there is a way to implement the implicit conversion in Python, much like the sample C# program below does. This is a question about the language, so please forgive me if I am asking in the wrong mai

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-24 Thread Cesar Mello
OK thank you very much! Best regards Mello On Fri, Feb 24, 2012 at 6:17 PM, Jeff Hardy wrote: > On Fri, Feb 24, 2012 at 12:00 PM, Cesar Mello wrote: > > Thank you very much for the quick response Jeff! > > > > First, let me clarify I am a Python newbie, so my assumptions about > Python > > may

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-24 Thread Jeff Hardy
On Fri, Feb 24, 2012 at 12:00 PM, Cesar Mello wrote: > Thank you very much for the quick response Jeff! > > First, let me clarify I am a Python newbie, so my assumptions about Python > may be all wrong. > > I had tried __float__ in a Python object, but it does not work implicitly > inside expressi

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-24 Thread Cesar Mello
Thank you very much for the quick response Jeff! First, let me clarify I am a Python newbie, so my assumptions about Python may be all wrong. I had tried __float__ in a Python object, but it does not work implicitly inside expressions (and I think that's the correct behavior). You still have to u

Re: [Ironpython-users] Implicit conversion of objects to float

2012-02-24 Thread Jeff Hardy
On Fri, Feb 24, 2012 at 10:54 AM, Cesar Mello 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