In <[EMAIL PROTECTED]>, asincero wrote: > def foo(a, b, c, d): > assert type(a) == str > assert type(b) == str > assert type(c) == int > assert type(d) == bool > # rest of function follows > > This is something I miss from working with more stricter languages like > C++, where the compiler will tell you if a parameter is the wrong type. > If anything, I think it goes a long way towards the code being more > self documenting. Or is this a waste of time and not really "the > Python way"?
Not really the Python way I'd say. What if `c` is of type `long` for instance? Your code would stop with an assertion error for a value that should work. Strict type checking prevents "duck typing" which is a quite fundamental concept in Python. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list