[Python-3000] signature annotation in the function signature or a separate line

Sam Pointon free.condiments at gmail.com
Mon Aug 21 01:26:57 CEST 2006

On 20/08/06, Guido van Rossum <guido at python.org> wrote:
> On 8/19/06, Samuele Pedroni <pedronis at strakt.com> wrote:
> > given the precedent of type inferenced languages
> > that use a separate line for optional type information
> Can you show us an example or two?


map :: (a -> b) -> [a] -> [b]
map f xs = ...

Note that type information can also be contained in an expression (and
by extension on the same line), though the convention for defined
functions is to have it on a separate line. This  type information is
not quite 100% optional - there are some corner-cases where the
typechecker needs a shove in the correct direction, or the inferred
type could be too general.


More information about the Python-3000 mailing list