IronPython in Action
Michael J. Foord and Christian Muirhead
  • March 2009
  • ISBN 9781933988337
  • 496 pages

... everything you need to get started with IronPython.

Jim Hugunin, Creator of IronPython

IronPython in Action offers a comprehensive, hands-on introduction to Microsoft's exciting new approach for programming the .NET framework. It approaches IronPython as a first class .NET language, fully integrated with the .NET environment, Visual Studio, and even the open-source Mono implementation. You'll learn how IronPython can be embedded as a ready-made scripting language into C# and VB.NET programs, used for writing full applications or for web development with ASP. Even better, you'll see how IronPython works in Silverlight for client-side web programming.

About the Technology

In 2005, Microsoft quietly announced an initiative to bring dynamic languages to the .NET platform. The starting point for this project was a .NET implementation of Python, dubbed IronPython. After a couple years of incubation, IronPython is ready for real-world use. It blends the simplicity, elegance, and dynamism of Python with the power of the .NET framework.

About the book

IronPython opens up exciting new possibilities. Because it's a dynamic language, it permits programming paradigms not easily available in VB and C#. In this book, authors Michael Foord and Christian Muirhead explore the world of functional programming, live introspection, dynamic typing and ‘duck typing’, metaprogramming, and more.

IronPython in Action explores these topics with examples, making use of the Python interactive console to explore the .NET framework with live objects. The expert authors provide a complete introduction for programmers to both the Python language and the power of the .NET framework. The book also shows how to extend IronPython with C#, extending C# and VB.NET applications with Python, using IronPython with .NET 3.0 and Powershell, IronPython as a Windows scripting tool, and much more.

Table of Contents detailed table of contents




about this book

Part 1 Getting started with IronPython

1. A new language for .NET

1.1. An introduction to IronPython

1.2. Python on the CLR

1.3. Live objects on the console: the interactive interpreter

1.4. Summary

2. Introduction to Python

2.1. An overview of Python

2.2. Python: basic constructs

2.3. Additional Python features

2.4. Summary

3. .NET objects and IronPython

3.1. Introducing .NET

3.2. Structures, enumerations, and collections: .NET types

3.3. Handling events

3.4. Subclassing .NET types

3.5. Summary

Part 2 Core development techniques

4. Writing an application and design patterns with IronPython

4.1. Data modeling and duck typing

4.2. Model-View-Controller in IronPython

4.3. The command pattern

4.4. Integrating commands with our running example

4.5. Summary

5. First-class functions in action with XML

5.1. First-class functions

5.2. Representing documents with XML

5.3. Reading XML

5.4. Handler functions for MultiDoc XML

5.5. The Open command

5.6. Summary

6. Properties, dialogs, and Visual Studio

6.1. Document observers

6.2. More with TabPages: dialogs and Visual Studio

6.3. Object serializing with BinaryFormatter

6.4. Summary

7. Agile testing: where dynamic typing shines

7.1. The unittest module

7.2. Testing with mocks

7.3. Functional testing

7.4. Summary

8. Metaprogramming, protocols, and more

8.1. Protocols instead of interfaces

8.2. Dynamic attribute access

8.3. Metaprogramming

8.4. IronPython and the CLR

8.5. Summary

Part 3 IronPython and advanced .NET.

9. WPF and IronPython

9.1. Hello World with WPF and IronPython

9.2. WPF in action

9.3. XPS documents and flow content

9.4. Summary

10. Windows system administration with IronPython

10.1. System administration with Python

10.2. WMI and the System.Management assembly

10.3. PowerShell and IronPython

10.4. Summary

11. IronPython and ASP.NET

11.1. Introducing ASP.NET

11.2. Adding IronPython to ASP.NET

11.3. ASP.NET infrastructure

11.4. A web-based MultiDoc Viewer

11.5. Editing MultiDocs

11.6. Converting the Editor into a user control

11.7. Summary

12. Databases and web services

12.1. Relational databases and ADO.NET

12.2. Web services

12.3. Summary

13. Silverlight: IronPython in the browser

13.1. Introduction to Silverlight

13.2. A Silverlight Twitter client

13.3. Videos and the browser DOM

13.4. Summary

Part 4 Reaching out with IronPython

14. Extending IronPython with C#/VB.NET

14.1. Writing a class library for IronPython

14.2. Creating dynamic (and Pythonic) objects from C#/VB.NET

14.3. Compiling and using assemblies at runtime

14.4. Summary

15. Embedding the IronPython engine

15.1. Creating a custom executable

15.2. IronPython as a scripting engine

15.3. Python plugins for .NET applications

15.4. Using DLR objects from other .NET languages

15.5. Summary

Appendix A: A whirlwind tour of C#

Appendix B: Python magic methods

Appendix C: For more information


What's inside

  • An introduction to IronPython, including a Python tutorial
  • Overview of the .NET framework for Python programmers
  • Embedding IronPython in applications
  • Extending IronPython with C#
  • IronPython web programming with ASP, Silverlight, and the DLR
  • Structured application programming
  • Testing with IronPython
  • The power of dynamic languages through easy introspection, functional programming, and metaprogramming.

About the reader

Whether you're a Python user exploring .NET or a .NET developer exploring the world of dynamic languages, IronPython in Action will get you started quickly and show you how to be productive with this powerful new tool.

About the authors

Michael Foord and Christian Muirhead both work full time with IronPython for Resolver Systems; creating a highly programmable spreadsheet called Resolver One. They have been using IronPython since before version 1.0 was released.

Michael Foord has been developing with Python since 2002. He blogs and writes about Python and IronPython far more than is healthy for one individual and in 2008 was made the first Microsoft MVP for dynamic languages. As the Resolver Systems community champion he speaks internationally on Python and IronPython. He maintains the IronPython Cookbook and IronPython-URLs websites, and can also be found online at In the real world he lives in Northampton, UK with his wife Delia.

Christian Muirhead began his career in a high-volume database environment, and for the last eight years has been building database-driven websites. He has five years of experience working with C#, the .NET framework, and ASP.NET. He has been using Python in most of his projects since discovering it in 1999, including building web applications for the BBC using Django. Christian is a New Zealander currently exiled in London with his wife Alice.

placing your order...

Don't refresh or navigate away from the page.
eBook $24.99 $35.99 3 formats + liveBook
IronPython in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks