Tracing function calls using Python decorators (://URLFAN)

How popular is your website?  
Enter a website above, we'll show you who's talking about it right now.
We're currently ranking the popularity of 3,783,534 websites by parsing 125,403,453 blog posts from 2,078,619 blog feeds.
Article Structure
54 paragraphs
26227 characters
5 images
12 outgoing links

Tracing function calls using Python decorators

Post Date: Mar 10, 2008 12:00 a.m.
Ranked website: feeds.wordaligned.org (Not Ranked Yet)

For full text please visit source:
http://feeds.wordaligned.org/~r/wordaligned/~3/249080202/echo


Contents Introduction A less invasive way Decorators Improving echo Wider application Work in progress Source Code Credits @ end Introduction Let’s suppose you want to trace calls to a function. That is, every time the function gets called, you want to print out its name and the values of any arguments passed by the caller. To provide a concrete example, here’s a function which calculates the dot product of two vectors. def dot(v, w): """Calculate the dot product of two vectors. Example: >>> dot((1, 2, 3), (3, 2, 1)) 10 """ return sum(vv * ww for vv, ww in zip(v, w)) To trace calls to the function you could just edit it and insert a print statement. def dot(v, w): print "dot(v=%r, w=%r)" % (v, w&#...

Content suppressed by ://URLFAN, for full article visit source

Buzz Words mentioned in article:

No buzz words were found in article
How popular is feeds.wordaligned.org?

Click here to view stats and graphs for feeds.wordaligned.org


More posts from feeds.wordaligned.org

Sugar Pie
From: feeds.wordaligned.org
Post Date: 2008-03-06 00:00:00

Question: in the code snippet bleow, what does the result stream, rs , approximate? from itertools import count, ifilter, izip from random import random as xy from math import hypot pt = lambda: (xy(), xy()) on = ifilter(lambda n: hypot(*pt()) < 1., count(1)) rs = (4. * j / i for i, j in izip(on, count(1))) The code isn’t wilfully obscure but I’ll admit it’s... more
Drawing Chessboards
From: feeds.wordaligned.org
Post Date: 2008-03-18 00:00:00

Contents The Python Imaging Library ImageMagick Google Chart API ASCII Text Unicode Block Elements And more Why? Teaser Thanks I wanted a picture of a chessboard. Rather than boot up some drawing software and cut and paste black and white squares I decided to write a program to create the picture. If you’d like to know why anyone would ever create work for themselves in thi... more
Ima Lumberjack, (s)he’s OK
From: feeds.wordaligned.org
Post Date: 2008-03-24 00:00:00

Introducing the team Ima, the new recruit, paired with Alyssa, our most experienced programmer. The two of them worked on the user interface. Noah and Seymour looked after the persistent storage layer. Once Seymour got Noah into unit testing — well, you just couldn’t stop them. Cy managed the build, installation, porting, tools, and generally helped sweep up any regressions. What a star! That left me, Lem and Eva free to work on the core of the product. Ben led the team, but you ... more


Feeds and posts are not affliated with ://URLFAN. They are displayed here simply for informational purposes, if you would like to remove your feed, posts, or domain from ranking and analysis, please contact us.

© 2006-2008 ://URLFAN (Server 202 Generated Dec 02 08 12:04 in -0.47 secs.)

Contact Us / About ://URLFAN / Notify me when my site is added or updated. / Add my RSS feed to ://URLFAN