Category Archives: Python

Python :: property set

It looks like Python is getting tuples with named members in 2.6 (http://www.oluyede.org/blog/2007/03/11/updates-from-python-svn-part-2/ and http://docs.python.org/dev/lib/named-tuple-factory.html). I suspect many of us have implemented similar functionality ourselves, e.g. Shannon -jj Behrens describes how he sometimes uses dictionaries to return composite polymorphic values … Continue reading

Posted in Python | Leave a comment

Python :: flatten

Although it can seem like a CS excercise, everyone will sooner or later have to write a “flatten” function — a function that takes a nested “list” and makes it one-dimensional: it should also handle Python data types in a … Continue reading

Posted in Python | Leave a comment

Python :: defprop – a very simple idiom for defining properties

Most attempts at making it easier to define properties in Python seem to quickly descend into metaclass obscurity. Metaclasses can surely solve the problem for an appropriate definition of solve, but “Explicit is better than implicit”, and “Simple is better … Continue reading

Posted in Python | Leave a comment