>
> Hi Anand,

   This is what I exactly mean. This is the thing I want to do. I am now
using python 2.5.1 . So is
   there a way that I can do a thing like this in python 2.5.1 ( an
alternative way).

  Heshan Suriyaarachchi

>
>
> >>> def f(x : "an integer", y: "another integer") -> "Sum of x and y":
> ...     return x + y
> >>> f.__annotations__
> {'y': 'another integer', 'x': 'an integer', 'return': 'Sum of x and y'}
>
> The help() function returns the annotation plus the docstring now.
> >>> f.__doc__ = "A sum function"
> >>> help(f)
> Help on function f in module __main__:
>
> f(x: 'an integer', y: 'another integer') -> 'Sum of x and y'
>    A sum function
>
>
>
>
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to