Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

The .NET developer's introduction to IronPython

4,779 views

Published on

A .NET developer introduction to IronPython - with code

Published in: Technology
  • Be the first to comment

The .NET developer's introduction to IronPython

  1. 1. The .NET developer’s introduction to IronPython<br />Dror Helper<br />
  2. 2. About.Me<br />Software developer (7 years)<br />.NET developer (mostly C#)<br />Language geek<br />Blogger – http://blog.drorhelper.com<br />
  3. 3. Agenda<br />Some background<br />Python basics<br />What is IronPython<br />Why should you care<br />
  4. 4. Python programming language<br />Created in 1990 by Guido van Rossum<br />General purpose high-level programming language<br />Named after Monty Python<br />
  5. 5. Python flavors<br />
  6. 6. What about IronPython? <br />
  7. 7. The Python language<br />
  8. 8. Multi Paradigm<br />
  9. 9. Dynamic but type safe<br />The interpreter keeps track of all variables types<br />Cannot do anything that's incompatible with the type of data you're working with<br />Types can change<br />Variable is simply a value bound to a name<br />
  10. 10. Data Types<br />
  11. 11. Indention instead of brackets<br />foriinrange(100): <br />ifi % 3 == 0:<br />ifi % 5 == 0:<br />print“FizzBuzz”<br />else:<br />print“Fizz”<br />elifi % 5 == 0:<br />print“Buzz“<br />else:<br />printi<br />
  12. 12. Python focus<br />Duck Typing<br />List comprehension<br />
  13. 13. Duck Typing<br />class Duck: <br />def quack(self): <br />print("Quaaaaaack!") <br />class Person: <br />def quack(self): <br />print("The person imitates a duck.") <br />defin_the_forest(duck): <br />duck.quack() <br />def game(): <br />donald = Duck() <br /> john = Person() <br />in_the_forest(donald) <br />in_the_forest(john) <br />game()<br />
  14. 14. List Comprehension<br />What would be the values of listB?<br />listA = [j for i in range(2, 8) for j in range(i*2, 50, i)]listB = [x for x in range(2, 50) if x not in listA]<br />[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]<br />
  15. 15. What about IronPython? <br />
  16. 16. IronPython Goals<br />True Python Implementation<br />Seamless integration with .NET<br />
  17. 17. IronPython is:<br />Open source<br />Supports both .NET & Mono<br />All CLR types are available<br />Can call .NET code<br />
  18. 18. IronPython IDEs<br />VS2010 + IronPython extension<br />#Develop<br />Wing<br />Eclipse + PyDev<br />For more details see: http://www.voidspace.org.uk/ironpython/tools-and-ides.shtml<br />
  19. 19. The interactive shell<br />Run code on the fly<br />Run .NET code on the fly<br />>>> print "Hello, world"<br />Hello, world<br />>>> x = 12**2<br />>>> x/2<br />72<br />>>> # this is a comment<br />
  20. 20. IronPython in the real world<br />Use IronPython as part of your .NET applications<br />WPF<br />PowerShell<br />ASP.NET<br />Spark<br />Silverlight<br />Robotics Studio<br />XNA<br />Scripting engine<br />
  21. 21. Where to start<br />Download IronPython and give it a try<br />TryPython - http://ironpython.net/try/<br />Read a book<br />Add IronPython to your utility belt<br />
  22. 22. Resources<br />IronPython - http://ironpython.net/<br />IronPython on Codeplexhttp://ironpython.codeplex.com/<br />Books:<br />Dive into Python - http://diveintopython.org/<br />IronPython in Action - http://www.ironpythoninaction.com/<br />Blogs:<br />Voidspace techie blog: http://www.voidspace.org.uk/python/weblog/index.shtml<br />Getting started with IronPython - http://blogs.microsoft.co.il/blogs/dhelper/archive/2009/05/01/beginning-ironpython-development-part-1-where-to-start.aspx<br />Integration:<br />ASP.NET: http://aspnet.codeplex.com/wikipage?referringTitle=Home&title=Dynamic%20Language%20Support<br />SilverLight: http://www.voidspace.org.uk/ironpython/silverlight/index.shtml<br />Spark: http://sparkviewengine.com/documentation/ironpython<br />

×