[IronPython] Casting python list type to NET type

Sanghyeon Seo sanxiyn at gmail.com
Fri May 25 03:29:59 CEST 2007

2007/5/25, Michael Foord <fuzzyman at voidspace.org.uk>:
> You could make this conditional by wrapping the import in a 'try..
> except' and having different behaviour on platforms where the .NET type
> is not available (i.e. CPython).

Or, check sys.platform. If you intend to run the same code on both
CPython and IronPython, and if you want some section of code to run
only on IronPython, the best way I found is:

if sys.platform == 'cli':
# IronPython specific

Seo Sanghyeon

More information about the Ironpython-users mailing list