Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Python + .NET = IronPython : Page 2

IronPython brings the interactivity and productivity of the Python language to the.NET world.


advertisement
What Is Python?
The Python language is part of a growing family of dynamic programming languages that include names like Boo (another .NET-based dynamic language), Groovy (a Java-based scripting language), Scheme, and Ruby. Wikipedia defines a dynamic programming language as "a kind of programming language in which programs can change their structure as they run: functions may be introduced or removed, new classes of objects may be created, [and] new modules may appear."

Standard releases of Python include an interactive console that lets developers enter commands interactively, displaying the results and thus making it easy to try out the syntax of a new command or see the output of a call to particular function. The standard Python library includes a wide array of built-in functions, types, exceptions, and constants. The latest version of the Python library documentation describes each of these in great detail.

Everything in Python is an object and thus exhibits all the behavior you would expect from an object, including things such as attributes, methods and inheritance. Arguments to a function call are passed as object references, extending this concept one step further. The design of the language, its small size, and its simple syntax make it easy to teach new developers the basic concepts of object orientation and how to use objects to build a complete program. Each release of the language includes a complete Python Tutorial updated to reflect any new features added since the last version.

I took a personal interest in Python a little over a year ago while trying to decide which computer language to use to teach my then 14-year-old son the basics of programming. One requirement I had for choosing a language was that it had to run on multiple operating systems, including Windows 98 (because that was what my son's hand-me-down computer was running). Python filled that requirement. I was particularly attracted to Python's interactive interpreter which lets you try out language features and get immediate results.

For newcomers to the Python language, the most immediately obvious feature is the use of whitespace. In Python, whitespace—the indentation of lines of code—is significant and takes the place of curly brackets or other "block" syntax conventions used in other programming languages. If you don't adhere to this convention, the interpreter complains and refuses to execute your code.

For example, the code to print the square of the numbers 1 through 12 in C#, VB.NET and Python would be:

C#

for (int inum=1; inum<13; inum++) { System.Concole.Writeline(inum**2); }

VB.NET

For inum = 1 to 12 Debug.print inum**2 Next inum

Python



For inum in range(12): Print num**2



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap