Python Programming, news on the Voidspace Python Projects and all things techie.
I used decorators for the first time a couple of days ago (at work) .
I was pleased (and surprised), that not only did I get the syntax right without looking it up, but it worked first time . Hooray, bonus points for me.
It was a simple decorator for test methods in our home-brew unittest framework, it just prints the function name when it's called. This was so we could see exactly which test was freezing.
"""Prints the function (or method name) when called."""
name = func.func_name
def decorated(*args, **keywargs):
return func(*args, **keywargs)
We're now part-way through swapping all our tests over to the Python UnitTest framework. So this code isn't needed, but it was fun to play.
The biggest hassle in changing over, is that our framework followed the test parameter conventions of the Java unit test framework that the Resolver boss was familiar with. Tests had the following parameter order :
message, expected, actual
PyUnit has  :
first, second, message
Corrected from earlier, thanks to reader comments which are correct.
I thought the Python framework owed its heritage to the common Java unit-test framework ?
Oh well, four-hundred tests converted, only about twelve-hundred more to go.
|||Well, once I'd corrected the compulsory typo.|
|||Yes we could have just wrapped the tests, but in the long run it would just cause confusion; especially if anyone joined us who was familiar with the normal ordering.|
New IronPython Home
IronPython, has a new home... almost.
There's not much there yet. So is Codeplex Microsoft's answer to sourceforge ?
In Michael Swanson's Blog, he quotes :
CodePlex is an online software development environment for open and shared source developers to create, host and manage projects throughout the project lifecycle. It has been written from the ground up in C# using .NET 2.0 technology with Team Foundation Server on the back end.
So, not that unlike sourceforge hey...
In totally unrelated news, it looks like there are at least two ways of running Mac OS X on an ordinary PC :
Maybe I don't need to buy a Mac mini after all, and can just build my own PC...
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.