Let me start by introducing some static typing information that could be extracted from an IDE, or used by pychecker or pylint.
The above is totally valid Python. Just like doctests can be extracted by the doctest module, the "typecheck" assertions could be extracted and used by other programs. However, as they stand, they are "totally optional".
01 def gcd(a, b):
02 '''Returns the Greatest Common Divisor,
03 implementing Euclid's algorithm.
04 with __typecheck__:
05 assert isinstance(a, int), 'First argument must be an integer.'
06 assert isinstance(b, int), 'Second argument must be an integer.'
07 #Some doctests for good measure
08 >>> print gcd(6, 3)
08 while a:
09 a, b = b%a, a
10 return b
Now, if we wanted to use the typechecking information in some module where gcd() is actually used, we would have to instruct the interpreter to do so ... here's a way we might want to write this:
1 with __typecheck__:
4 # the rest of the code follows...
Granted, this is not currently valid in Python ... but its intent should be understandable!