Help and Tips

TwitterFacebook
Get flash to fully experience Pearltrees
http://ozkatz.github.com/improving-your-python-productivity.html

Improving Your Python Productivity | Eventual Consistency

I've been programming in python for a few years now, and I'm still often amazed by how clear and DRY well written Python code can be. There are many small tips and tricks I've learned over time, mostly by reading the code of popular open source projects, such as Django , Flask , Requests and others. Here are a few things I've picked up that are sometimes overlooked, but can really help with everyday work. 1.

Better Python APIs | Eventual Consistency

http://ozkatz.github.com/better-python-apis.html Python comes with a large number of built-in functions, operators and keywords. They make working with data structures and built-in types very easy, but usually when we define our own data types (classes) we also tend to come up with our own ways to manipulate and consume our data. One of the nice things in python, is that we don't have to. We can use "underscore methods" to make our classes compatible with the built-in functions and operators. This makes our code easier to use and does a better job of hiding our nasty, complex implementation from the user.

Determining the Name of a Process from Python - Doug Hellmann

Finding the name of the program from which a Python module is running can be trickier than it would seem at first, and investigating the reasons led to some interesting experiments. A couple of weeks ago at the OpenStack Folsom Summit, Mark McClain pointed out an interesting code snippet he had discovered in the Nova sources : nova/utils.py: 339 script_dir = os . path . dirname ( inspect . stack ()[ - 1 ][ 1 ]) http://doughellmann.com/2012/04/determining-the-name-of-a-process-from-python-2.html

Python Iteration

Created 24 April 2012, last updated 19 March 2013 This is a presentation I gave at PyCon 2013. You can read the slides and text on this page, or open the actual presentation in your browser (use right and left arrows to advance the slides), or watch the video: A talk for PyCon 2013. http://nedbatchelder.com/text/iter.html
Python Community Sites

3. Using Python on Windows — Python v2.7.2 documentation

http://docs.python.org/using/windows.html This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. 3.1. Installing Python

A Python for Windows Tutorial

http://www.imladris.com/Scripts/PythonForWindows.html This document discusses some of the common pitfalls in getting python scripts running under Windows, with an emphasis on enabling python cgi scripts through Windows Apache. On the PYTHONPATH Finding python.exe
pycon 2010 atlanta presents the mighty dictionary (#55) by brandon craig rhodes video produced by carl karsten & a team in conjunction with the psf and support from: [sauce ___ ijwbitz you too can support the psf: http://www.python.org/psf/donations/ 9: how can python lists access every one of their items with equal speed? timeit(’mylist[o]’, my1ist = [1] * 9000’) /1 — -> 0.053692102432250977 ‘50 ns per getitern timeit(’mylist[7000]’, ‘mylist = [1] * 90001) # -- 0.051i60ø276947ø2148 —50 ns per getitem 9: how can python lists access every one of their items with equal speed?

PyCon 2010:The Mighty Dictionary (#55)

http://talkminer.com/viewtalk.jsp?videoid=bliptv3332763&q=#.UVX1S9F-P0N
http://effbot.org/zone/default-values.htm

Default Parameter Values in Python

Python’s handling of default parameter values is one of a few things that tends to trip up most new Python programmers (but usually only once). What causes the confusion is the behaviour you get when you use a “mutable” object as a default value; that is, a value that can be modified in place, like a list or a dictionary. An example: >>> def function(data=[]): ... data.append(1) ... return data ... >>> function() [1] >>> function() [1, 1] >>> function() [1, 1, 1] As you can see, the list keeps getting longer and longer. If you look at the list identity, you’ll see that the function keeps returning the same object:
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html 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 .

Code Like a Pythonista: Idiomatic Python