Python Articles and Other ScribblingsSelected Writing and Ravings![]()
From time to time I write something. Occasionally what I write will be worth reading. These are links to a few of the technical and python related articles I've written. It might include tutorials, rants, ideas, or anything else. If you're more interested in actual code, you probably want the Python Index Page, which has links to my Python modules, programs, and smaller "recipes".
IronPython in ActionI'm currently writing a book for Manning publications on programming with IronPython. Most of the book is already available to read in electronic form via the Manning Early Access Program: The Microsoft UK developer newsletter MSDN Flash, has published an article of mine on Getting Started with IronPython. This is one of their first experiments in publishing articles by non-Microsoft employees: Programming with IronPython, Silverlight and Windows FormsIn real life I work with a firm called Resolver Systems. We are developing a programmable spreadsheet application, called Resolver One, with IronPython and Windows Forms. IronPython is a Microsoft implementation of Python, written in C#. It has full integration with the dotnet framework. Windows Forms is a great way of creating native looking applications using IronPython. I have also written a series of articles on programming with Silverlight and IronPython (including online demos and examples to download): The IronPython CookbookI've also started a Wiki with samples of using IronPython and the .NET framework. It includes over 100 examples of system administration, sending and receiving Udp, interoperating with the system, IronPython and Silverlight and lots more. A Series of TutorialsThis is a series of articles on accessing HTTP from Python. The first one is a tutorial on the Python module urllib2. It covers fetching URLs, coping with errors, and using handlers and openers. It should be useful to anyone new to using urllib2. The second explains the subject of BASIC authentication. It illustrates how authentication works, and then goes through a simpler example showing how to handle it properly ! If you need to fetch web pages from a server protected with Basic authentication [1], this will tell you what you need to know. The third article is about handling cookies when fetching web pages. By default Python doesn't do this. In Python 2.4 a new module called cookielib has been added to the standard library. Prior to Python 2.4 it existed as ClientCookie. This article shows you how to use these modules to handle cookies automatically when fetching webpages from Python. A Few Articles Related to PythonThese articles are yet more writings on the subject of programming with Python. A Python Programming Style GuideI care about code quality. Code should be beautiful (elegant) and part of that means it needs to look beautiful. This is a rough guide to my own preferences in source code style for Python programming: An Introduction to Python and its Data-TypesA brief introduction to Python and it's basic data-types, which may one day become part of a tutorial. In the meantime it covers the different built-in data types and the Python syntax for them. Object Oriented ProgrammingA Python and Objects TutorialAn introduction to object oriented programming with Python. This article is for relative beginners to Python who would like to understand what Object Oriented programming is all about. It will introduce you to classes, as well as explaining the concepts behind them. Python, Windows and the Command LineThis article is a tutorial on setting up a basic command line environment. It is aimed at new programmers who may not have used the command shell environment before. It conatins a few tips and tricks specific to Python, but should be useful to anyone who wants to use the Windows console. Python and Rich ComparisonPython rich comparison has always annoyed me, at least having to provide all the rich comparison methods has always annoyed me. This article shows how CPython differs from IronPython in this respect. It also implements a 'rich comparison mixin' class, so that you can have all of them just by providing two methods (instead of six). There is an example of using it, along with full unit tests. (Which serve as a good example of using the unittest module if you haven't used it before.) Introduction to MetaclassesThis brief tutorial will introduce you to the basic concept of metaclasses. It illustrates them with a metaclass that will automatically decorate all the methods in a class. This can be used to do really useful things like remove the need to explicitly declare self in methods. Python Properties and C# 3.0 Language FeaturesAn article exploring Python properties - comparing them to C#, looking at the new way of declaring them coming in Python 2.6 and an alternative method inspired by C#. This is followed by a look at some of the new features in C# 3.0 and whether Python has anything to learn from them (including a look at whether LINQ could work in Python): Mocking, Patching, Stubbing: all that StuffAn article on the subject of mocking, patching and stubbing in tests. It is also an introduction to the Mock class and the rational behind it. Exploring Dynamic Scoping in PythonAn experimentation with Python code objects, bytecode and the Python scoping rules. (This article used to be called Anonymous Code Blocks in Python.) It uses the excellent Byteplay module to explore Dynamic Scoping in Python. It results in a function called AnonymousCodeBlock. This can take a function and return a code object representing the function body. Local variables used by the function you passed in, and names bound by it, will be looked up and bound in the scope in which you execute the code. Duck Typing in PythonThis article starts with an introduction to typing, and finishes with a rant about duck typing. Specifically, it is a rant about how the poorly defined concepts of the Mapping Type and the Sequence Type make some kinds of duck typing impossible - and suggests a way round this. Mapping and Sequence Type ReferenceThis is three pages from the Python documentation on the Mapping and Sequence type objects. A handy reference for anyone who has ever struggled to find the pages in the Python docs which tell you the special methods to implement. Guessing Text EncodingsThis is an article about how to guess the encoding for arbitrary text files. This is vital if you want to be able to correctly interpret or display text. This article was prompted by a discussion of how Python 3000 will handle text, so you can quickly get up to speed on some of the ways that Python is evolving. Data Persistence with ConfigObjThis is an article that describes how to use ConfigObj for data persistence. Storing and restoring data structures is a common problem for programmers and ConfigObj is suitable for many simple data persistence problems. This is especially true if a human readable format is an advantage [2]. The article also provides tools for automatically creating 'configspecs', for config file validation. Upgrading PythonDecember 2004Every eighteen months or so, a new version of Python comes out. They represent a lot of hard work, and in the case of Python 2.4 - a heck of a lot of arguing about decorator syntax. I first started to learn Python about mid 2003, which meant the change from Python 2.2 to 2.3 had just happened. I think I did have Python 2.2 installed, maybe even for as long as several days ! Python 2.4 was the first time I really had to contend with a major version upgrade. This article is about the problems associated with upgrading, the set of python modules that I actually use, and the difficulties of compiling C extension modules under windows. Python 411 - An Interview with Ron StephensApril 2nd 2006This is an interview with me, by Ron Stephens, from his Python 411 Series. It is about how I got into programming, and how I got on with Python.
Published ArticlesA few of my articles have been published in PyZine - the online Python magazine. A Crash Course in Character EncodingsThe mere mention of Unicode can be enough to bring some programmers out in a sweat. Unfortunately the days of burying our heads in the sand and pretending that encodings are not an issue have long gone. If your program isn't aware of different encodings, then the chances are that many people can't use it. Fortunately, Unicode in Python isn't as difficult as it's reputation. This
article is a Unicode tutorial and will get you up to speed very quickly. At
the time of writing it was free to read as well. Python at Both Ends of the WebThis is a three part set of articles on using Python with the internet. The first part appeared in issue 7 - and is about writing web clients, programs that access the internet. The second and third parts are about writing web applications, as Python CGIs. The first part of this appeared into issue 8, and is free to view. The first part of this article is sometimes offline. You can view a cached version of this article at CGI Articles Part One. The second part of the CGI article is available on Voidspace : Articles in Other LanguagesSeveral of the articles here have been translated into other languages. French translations of the articles on working with HTTP and Python. The articles were translated by Gerard Labadie and the HTML markup done by Thomas
Labadie (11 years old). There is a Portuguese translation (By Luiz Carlos Geron) and a French translation (By Gerard Labadie), of Object Oriented Programming with Python : Technical DetritusObject Shaped FutureWhich Programming Paradigm Will Last ?This article looks at modern programming languages, the ones we call high level languages, and whether they can last into the future of computer programming. SpamtrapStopping the SpammersThis article contains an interesting technique for stopping spam - all spam. This takes the war on spam to a new level. Instead of constantly battling to recognise spam, we increase the costs of sending spam tenfold - or even a hundredfold. The article is a work in progress - I haven't yet written the code to implement the idea - but it might just work... New Voidspace ManifestoOctober 2004Voidspace was (is ?) a sprawling mess. Now this is possibly a fair reflection on my mindset, but it was impossible to maintain, took up too much bandwidth, and was suffering from a bad case of link rot. On top of all that the HTML was pretty awful. These python pages were the first converted over to an XHTML and CSS design. This article was my attempt to decide how I should organise the revamp, and what tools I wanted. Note The set of tools I envisaged have become a reality, in the form of rest2web. Me, Myself and uhm...My other writings are all collected over in the Voidspace section. This includes the my life story part 1 and part 2, a collection of my poems, and various other marvellous ramblings. Other Articles on VoidspaceVarious articles on computing. These are hosted over in a different section of Voidspace, but are well worth a read.
You can read other blogs, and news on similar topics, over at Planet Voidspace. This is updated hourly, and has combined blogs on Cyberpunk, programming, humor and science.
For buying techie books, science fiction, computer hardware or the latest gadgets: visit The Voidspace Amazon Store. If you're looking for a new techie job, try the Voidspace Tech Job Board. This is part of the Hidden Network of technology and programming jobs.
Last edited Mon Apr 21 00:56:15 2008. Counter... |
|||||||||||||||||
|
Blogads
Follow me on: Tech Jobs |
|||||||||||||||||