background preloader

Code Like a Pythonista: Idiomatic Python

Code Like a Pythonista: Idiomatic Python
In this interactive tutorial, we'll cover many essential Python idioms and techniques in depth, adding immediately useful tools to your belt. There are 3 versions of this presentation: ©2006-2008, licensed under a Creative Commons Attribution/Share-Alike (BY-SA) license. My credentials: I am a resident of Montreal,father of two great kids, husband of one special woman,a full-time Python programmer,author of the Docutils project and reStructuredText,an editor of the Python Enhancement Proposals (or PEPs),an organizer of PyCon 2007, and chair of PyCon 2008,a member of the Python Software Foundation,a Director of the Foundation for the past year, and its Secretary. In the tutorial I presented at PyCon 2006 (called Text & Data Processing), I was surprised at the reaction to some techniques I used that I had thought were common knowledge. Many of you will have seen some of these techniques and idioms before. These are the guiding principles of Python, but are open to interpretation. import this

http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html

Related:  PythonPython

Solving Every Sudoku Puzzle by Peter Norvig In this essay I tackle the problem of solving every Sudoku puzzle. It turns out to be quite easy (about one page of code for the main idea and two pages for embellishments) using two ideas: constraint propagation and search. Sudoku Notation and Preliminary Notions First we have to agree on some notation. A Sudoku puzzle is a grid of 81 squares; the majority of enthusiasts label the columns 1-9, the rows A-I, and call a collection of nine squares (column, row, or box) a unit and the squares that share a unit the peers.

ghPython – New component and parallel modules Just in time for Christmas… ghPython 0.6.0.3 was released this week and it has two new features that I’m really excited about. Download ghPython… A little background David Rutten was visiting the McNeel Seattle office in November to discuss future work on Grasshopper and Rhino. When David is in town it always gives me the chance to brainstorm with him and try to solve some of the features that users ask for. s Python Class - Google's Python Class - Google Code Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. The class is geared for people who have a little bit of programming experience in some language, enough to know what a "variable" or "if statement" is. Beyond that, you do not need to be an expert programmer to use this material.

Dev Explorer - Developing Console Interfaces Using Python and ... Date Published: 18/05/2009 14:39 In general I spend quite a lot of time building python applications and scripts for home and office use. These vary from scripts at home for cleaning up my music library to decent sized applications implementing business logic. Python Cost Model - 6.006 Wiki From 6.006 Wiki Python is a high-level programming language, with many powerful primitives. Analyzing the running time of a Python program requires an understanding of the cost of the various Python primitives. For example, in Python, you can write: Python Examples On these pages, I have collected a bit of information about the Python programming language, along with a bunch of examples. These might be useful if you want to see some of the features without actually learning the language itself. You don't have to read through all of this in order. Just pick the pages which look most interesting to you. The topics are fairly independent from each other and don't require any existing knowledge about Python.

Intro to Python Scripting: 02 Varibles and Input/Output OK, in this video we finally get to do a little Rhino, albeit a very little. We are building up in small steps, partly because it keeps the videos short and I think bite sized chunks are helpful in these intro videos. This video covers a couple of varible types and a little bit about naming conventions. We also look at getting info from the user via Rhino's command line. Simple stuff but it leads to good scripts later.

6 Books Every Programmer Should Own I’ve seen many lists about the best programming books and I am sure there are a lot of books that are specific to a programming knowledge or technology – that I have not included in my list. The books I have chosen are those that are meant to inspire, increase productivity and improve your programming design skills. Note: This list has no particular order. Code Complete 2 Steve McConnell The main focus of this book to help you improve your programming design skills.

Google Python Style Guide No whitespace inside parentheses, brackets or braces. No whitespace before a comma, semicolon, or colon. Do use whitespace after a comma, semicolon, or colon except at the end of the line. Yes: if x == 4: print x, y x, y = y, x No: if x == 4 : print x , y x , y = y , x No whitespace before the open paren/bracket that starts an argument list, indexing or slicing. Popular Python recipes Welcome, guest | Sign In | My Account | Store | Cart ActiveState Code » Recipes Languages Tags Authors Sets NOTE: Recipes have moved! Python Basic Syntax with Python by Dale Fugier This guide presents an overview of Python syntax. Overview

Related:  Games and Tutorials