In this article we take a deep look at IronPython Interactive Console. We will see some basics of Python and IronPython to become acquainted with the IronPython environment.
IronPython interactive interpreter console is the easiest way to start using IronPython. We can easily explore whole IronPython world which is include ironpython modules, .Net libraries and Python Built-in’s. For IronPython starters it’s great way to exploring .Net Libraries. We can use IronPython Interactive Interpreter for start to developing WinForms, COM objects, WPF, XNA, Embeding C#, Silverlight,… projects.
Let’s check out some common commands which we will use for exploring Ipy on it.
help()
help() function that is particularly useful for exploring objects at the interactive console with dir() function.
help(dir)
With this command we can easily explore any object in IronPython!
dir()
This function returns all the members of an object as a list of strings.
If we run dir() function we can see which modules included in ironpython current work space.
>>>dir(help)
returns list of members for help function.
>>>help.__doc__
With this command it returns how can we use help function. By the “__doc__” element we can easily explore .NET libraries which we don’t know.
We can use IronPython Console as a calculator :)
>>>5+12
17
Without variable pre-declaration of data types we can assign a value to a variable.
>>ipy = “ironpython”
To get output we use print command, it is simple and easy as “print ipy”. Programming is now very funny :)
>>>print ipy
ironpython
We can use every letter of a word as an element of array in IPy loop. As you see we didn’t declare “i” in “for statement”.
>>>for i in ipy:
... print i
i
r
o
n
p
y
t
h
o
n
we assigned ipy variable as a string now we will assign it as an integer.
Let’s assign ipy variable value as an array.
>>>ipy = ["iron","python","ironpython"]
>>>print ipy
["iron","python","ironpython"]
As you see there is no error with assigning of data types. We can use same variable for several data types.
With functions we can develop application more programmaticly.
we define functions with "def" like above template.
Functions need to enter space before print. First line which include “def” and function name, arguments. We use whitespace in function code. There is same situation for loops and statements. Levels of spaces similar like C# curly braces; tell us where functions start and where functions end, also tell us nested structures.
def addition(a,b):
return a+b
>>>addition(3,8)
11
>>>addition("Iron","Python")IronPython
The IronPython code above, we can add 2 string or 2 integer.
After importing libraries we can start developing.
>>>import math
>>>dir(math)
>>>from math import log10 #we imported log10 function from math library
>>>log10.__doc #we can see instruction of log10
>>>log10(1000) #we can use this function after lookin doc
After the enter codes above, the console contents will be like below.

As you see finding a module and using it in IronPython is too easy!
For exit the IronPython Interactive console; Ctrl+Z or F6 followed by Enter. You can use ^Z or exit() command
All The Best!