How do I create static class data and static class methods?

Static data (in the sense of C++ or Java) is easy; static methods (again in the sense of C++ or Java) are only supported for new-style classes.

For static data, simply define a class attribute. To assign a new value to the attribute, you have to explicitly use the class name in the assignment:

class C:
    count = 0   # number of times C.__init__ called

    def