11

... does it requires some sort of wrappers?

I was under expression that IronPython is a .NET implementation of the Python which somehow magically enables applications built with IronPython to use standard Python libraries (which I believe either a raw .py sources or .py source packaged into the eggs), but when I was reading http://www.doughellmann.com/PyMOTW/hashlib/index.html at the bottom of the page I spotted: "A wrapper for hashlib that works with IronPython." which immediately put me on guard...

Andrew
  • 113
  • 1
  • 4
  • IronPython is a re-implementation of the Python language in the CLR. So it won't necessarily have all the library support. They made many available, but don't expect 100% portability with CPython programs. – Keith Jul 28 '11 at 08:14

2 Answers2

14

It depends:

  • If a library module is implemented in pure python, it is likely to work.
  • A library module that is implemented in C will not work. The ironclad project aims to allow IronPython to import and use compiled Python C extensions.
codeape
  • 97,830
  • 24
  • 159
  • 188
  • This is correct. Also keep in mind, that you will of course have access to the extensive .NET base class library (this ability being IronPython's greatest asset) that has every builtin I've ever needed in addition to the ones that are included in Ironpython. Not to mention any third party .NET library out there that can be effortlessly integrated into your ironpython project with just a simple `clr.AddReference()`. – Aphex Aug 01 '11 at 18:39
  • And then you also have modules that are re-implemented. An example is the ``re`` module (for doing regular expression matching). In CPython, the ``re`` module is a Python module that uses C extension modules. In IronPython, the ``re`` module is implemented in C# and uses the BCL's System.Text.RegularExpressions. – codeape Aug 02 '11 at 07:39
2

No - you can't use all standard libraries. And even all existing IronPython standard libraries are not the same as in python - all of them are new implementation - for example you can use datetime python module but it doesn't have strptime implementation as in pure python and so on.

You can read more here and Does IronPython implement python standard library?

In general IronPython 2.6 is an implementation of Python 2.6 but not all standard python modules were migrated into the IronPython.

Also you can read the following IronPython vs. Python .NET

Community
  • 1
  • 1
Artsiom Rudzenka
  • 27,895
  • 4
  • 34
  • 52