background preloader

Python

Facebook Twitter

Style

Graphviz. For:stolati. Code Like a Pythonista: Idiomatic Python. Ctypes tutorial. Note: The code samples in this tutorial uses doctest to make sure that they actually work. Since some code samples behave differently under Linux, Windows, or Mac OS X, they contain doctest directives in comments. Note: Quite some code samples references the ctypes c_int type. This type is an alias to the c_long type on 32-bit systems. So, you should not be confused if c_long is printed if you would expect c_int - they are actually the same type. ctypes exports the cdll, and on Windows also windll and oledll objects to load dynamic link libraries. You load libraries by accessing them as attributes of these objects. cdll loads libraries which export functions using the standard cdecl calling convention, while windll libraries call functions using the stdcall calling convention. oledll also uses the stdcall calling convention, and assumes the functions return a Windows HRESULT error code.

Windows appends the usual '.dll' file suffix automatically. >>> getattr(cdll.msvcrt, "?? >>> pi[0] 99 >>> Distutils-SIG. Charter The Distutils-SIG exists to discuss the design, implementation, and maintenance of a suite of module distribution utilities for Python.

Distutils-SIG

These utilities are grouped in the 'distutils' package in Python. The goal of distutils is to make building, packaging, distributing, and installing Python modules, extensions, and applications painless and standardized. There are also third-party tools built on the top of distutils, that are using the Distutils mailing list as their home.

Namely: setuptools zc.buildout If you are packaging a Python package, this SIG is probably a good starting point to ask questions. The goal of Distutils-SIG is also to try to catch the good bits and practices from third-party projects and insert them in Distutils itself to serve the community. What's Available Interested in learning more or trying out the Distutils? Django. Essential Python Reading List. Here’s my essential Python reading list.

Essential Python Reading List

I’ve tried to order the items so you can pause or stop reading at any point: at every stage you’ll have learned about as much possible about Python for the effort you’ve put in. The Zen of Python The Zen of Python is so short I can include it here in its entirety. Typing import this in an interpreted session gives a pythonic spin on “Hello, world”. >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. If this doesn’t ring true, Python isn’t for you. Python Tutorial Your next stop should be the Python tutorial. FlickrUploadr - Linux. Custom Search Python. How not to write Python code » Ikke’s blog.

Lately I’ve been reading some rather unclean Python code.

How not to write Python code » Ikke’s blog

Maybe this is mainly because the author(s) of the code had no in-depth knowledge of the Python language itself, the ‘platform’ delivered with cPython,… Here’s a list of some of the mistakes you should really try to avoid when writing Python code: Some days ago RealNitro pointed me at this list of essential Python readings. “Idiomatic Python” is a must-read, even for experienced Python developers. That’s about it for now, maybe I’ll add some more items to this list later on. If you have some other hints, comments! Posted in Development, Technology. Tagged with Development, python. By Nicolas – February 8, 2008. Mark Lutz's Home Page. Package Index.

Python Documentation.