background preloader

30_Guides, Quick References, Tutorials

Facebook Twitter

Building Skills in Programming — Building Skills in Programming. Legal Notice This work is licensed under a Creative Commons License.

Building Skills in Programming — Building Skills in Programming

You are free to copy, distribute, display, and perform the work under the following conditions: Attribution. You must give the original author, Steven F. Lott, credit.Noncommercial. For any reuse or distribution, you must make clear to others the license terms of this work. Getting Started Tools and Toys This part provides some necessary background to help non-programming newbies get ready to write their own programs. We’ll start with the big picture. In Let There Be Python: Downloading and Installing we’ll describe how to install Python. We’ll describe two typical problems that Python can help us solve in Two Minimally-Geeky Problems : Examples of Things Best Done by Customized Software.

We also provide some history and background to help show why Python is so cool. Arithmetic and Expressions Before Reading and ‘Riting comes ‘Rithmetic The heart of Python is a rich variety of numeric types and arithmetic operators. 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. Python Tutorial. A Guide to Python's Magic Methods « Rafe Kettler Copyright © 2012 Rafe Kettler Version 1.17 A PDF version of this guide can be obtained from my site or Github.

A Guide to Python's Magic Methods «

The magic methods guide has a git repository at Any issues can be reported there, along with comments, (or even contributions!). Table of Contents Introduction This guide is the culmination of a few months' worth of blog posts. What are magic methods? Learn Python The Hard Way, 2nd Edition — Learn Python The Hard Way, 2nd Edition.

General, how-tos

Python Mind, Beginner’s Mind. The practice of Zen mind is beginner’s mind.

Python Mind, Beginner’s Mind

The innocence of the first inquiry“what am I?” Is needed throughout Zen practice. The mind of the beginner is empty, free of the habits of the expert, ready to accept, to doubt, and open to all the possibilities. It is the kind of mind which can see things as they are, which step by step and in a flash can realize the original nature of everything.

10 Python one liners to impress your friends « /code/blog. Python. You have seen how you can reuse code in your program by defining functions once.


What if you wanted to reuse a number of functions in other programs that you write? As you might have guessed, the answer is modules. There are various methods of writing modules, but the simplest way is to create a file with a .py extension that contains functions and variables. Another method is to write the modules in the native language in which the Python interpreter itself was written. For example, you can write modules in the C programming language and when compiled, they can be used from your Python code when using the standard Python interpreter. A module can be imported by another program to make use of its functionality.

Example (save as import sys print('The command line arguments are:')for i in sys.argv: print i print '\n\nThe PYTHONPATH is', sys.path, '\n' How It Works First, we import the sys module using the import statement. Python Tutorials, more than 300, updated March 2, 2009 and carefully sorted by topic and category. Debugging with GDB - Iceweasel. Python - Building Skills in Python - Iceweasel. Introduction to Python - Iceweasel. Introduction Python is an excellent, cross-platform, object-oriented interpreted language.

Introduction to Python - Iceweasel

Besides ease of use, its main characteristic is that it enforces indentation (don't indent, and the program won't run.) As of Septembre 2004, there are weaknesses to be aware of if you intend to use Python to write GUI apps for Windows, though: Python is originally a command-line, text-mode scripting language, so requires some add-on to build GUI apps. There is no integrated way to build Windows applications, so you must use and distribute a toolkit (most people use wxPython, which is a wrapper around the famous, open-source, cross-platform wxWidgets toolkit) Unless you're ready to shell out $ to buy VS.Net ($?)

Setup At least three distributions of Python are currently available for the Windows platform (PythonWare used to be yet another package, but it's been deprecated): If you only need a basic distribution, try out Tiny Python. Compiling Pyco Psyco setuptools easy_install py2exe McMillan Installer Freeze. Python 2.6 Quick Reference.