Type signature

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Jul 24 16:57:00 EDT 2006


In <mailman.8471.1153760534.27775.python-list at python.org>, paul kölle
wrote:

> Marc 'BlackJack' Rintsch wrote:
>> In <mailman.8423.1153605052.27775.python-list at python.org>, Yacao Wang
>> wrote:
>> 
>>> However, type signatures are not only a kind of information provided for
>>> the compiler, but also for the programmer, or more important, for the
>>> programmer. Without it, we have to "infer" the return type or required
>>> agument types of a function, and this can't be done without seeing the
>>> implementation of it,
>> 
>> That's what documentation is meant for.  If you are forced to look at the
>> implementation, the documentation is bad.
> I think the OP refers to reading the *code*, the documentation might not
> exist (yet).

It should be right there under the `def` as docstring.

> Sometimes I feel python is easier to write than to read and
>  missing argument type declarations (just for documentation purposes)
> are  IMHO one reason. Another are missing (optional) argument type
> checks at runtime. Something like WrongArgumentType exceptions instead
> of rather unspecific AttributeError from deep inside the code would be
> very convenient.

The you start getting `WrongArgumentType` exceptions sooner or later for
arguments that have all the necessary attributes in place but are of the
wrong "type".  Very inconvenient.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list