I recently decided to try py.test as my test-running facility, in place of the old, boring unittest module.
It seems a nice piece of software so far, the only problem I encountered is making it work automatically with Python 3, on code built via 2to3 script.
For those not familiar with it, 2to3 is a script that converts code written for Python 2.x into code for Python 3.x, for example by replacing things like "string" and u"unicode" with b"bytes" and "string", .iteritems() with .items(), etc.
The excellent distribute packaging tool ...
This is a short bash script I wrote in order to automatically build the HTML version of some documentation using the Sphinx documentation system upon change of any file inside the documentation directory.
The script should be placed inside the documentation directory (the same containing the Sphinx Makefile, etc). Its behavior is quite straight-forward; what it does is:
#!/bin/bash ## Automatically build Sphinx ...
Do you know the popular programming challenge of generating the lyrics of the 99 Bottles of beer song using the shortest code possible? There's even a websites that collects these scripts in many different languages: http://www.99-bottles-of-beer.net/.
I took the challenge..
..and here it is my solution, in just 237 bytes of Python code! :)
w=lambda c,d:'%s bottle%s of beer on the wall%s\n'%(c or'No','s'[:c!=1],d) for i in range(99,-1,-1):print"\n".join([(w(i,',')*2)[:-14]+'.','Take one down, pass it around,'if(i ...
« Page 2 / 2