"""Example module without method argument type checking.

Pros:
Pinpointed tracebacks with very exact error messages.

Cons:
Lots of boilerplate typechecking code littered all over the place, 
obscuring functionality at the start of every function. 
Bloat will accumulate rapidly. +2 lines of boilerplate code per method and
argument.
If I at some point decide that floats are also ok, I'll need to crawl all 
over the code with a magnifying glass and a pair of tweezers. 
We don't catch errors of the type 
a = MyClass()
a.int_member = 'moo!"
a.process_data(1)

"""

class MyClass(object):
    """My example class."""
    def __init__(self, int_member = 0):
        """Instantiate a new MyClass object.
        
        IN:
        int_member = 0: <int>
            Set the value for the data member. Must be int.
             
        """
        # Boilerplate typechecking code.
        if not isinstance(int_member, int):
            raise TypeError("int_member must be int")
        # Initiallization starts here. May for example contain assignment.
        self.int_member = int_member

    def process_data(self, data):
        """Do some data processing.
        
        IN:
        data: <int>
            New information that should be incorporated. Must be int.
        
        """
        # Boilerplate typechecking code.
        if not isinstance(data, int):
            raise TypeError("data must be int")
        # Data processing starts here. May for example contain addition:
        self.int_member += data

# Test code. Decomment to play. :-)

#a = MyClass('moo')
#a = MyClass(9)
#a.int_member = 'moo'
#a.process_data('moo')
#a.process_data(9)
