[IronPython] Typecasting in ironPython

saurabh rawat rawatsaurabh at yahoo.co.in
Fri Mar 18 09:44:03 CET 2011


Hi Markus,
Thanks for the help.It helped !!!

Rgds, 
Saurabh


                                                  " The ultimate test of a relationship is to disagree but to hold hands..............."                     

--- On Fri, 18/3/11, Markus Schaber <m.schaber at 3s-software.com> wrote:

From: Markus Schaber <m.schaber at 3s-software.com>
Subject: Re: [IronPython] Typecasting in ironPython
To: "Discussion of IronPython" <users at lists.ironpython.com>
Date: Friday, 18 March, 2011, 1:38 PM

Hi, Saurabh,

Sorry for sending that borked message. Outlook 2010 is driving me nuts!

Saurabh Rawat wrote:

> NoisePath np = (NoisePath)255

This is C syntax which obviously doesn't work in (Iron)Python. Python is
a dynamically typed language, so type casts do not exist "by design".

But the enum class has a toobject method:
http://msdn.microsoft.com/de-de/library/system.enum.toobject.aspx

So (with the appropriate import statements), the following should do:

Np = Enum.ToObject(NoisePath, 255)

 Regards,

 Markus Schaber

___________________________
We software Automation.

3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 |
Fax +49-831-54031-50

Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com 
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects:
http://www.3s-software.com/index.shtml?sample_projects

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner |
Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 

_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110318/db90b3d8/attachment.html>


More information about the Ironpython-users mailing list