Type signature

Hugo Ferreira bytter at gmail.com
Mon Jul 24 13:22:49 EDT 2006


Which is expecially true when using IDEs with auto-completion.
Using VisualStudio/MonoDevelop and C# I rarely need to look at the
documentation because I can quickly see what a method accept and returns.
And when I need to pass flags or options, enums are much more neat and
encapsulated.

With Python I'm constantly looking at the documentation when surfing a
library. I personally like the terse code and abstraction features of Python
which is making me slowly writing more and more tools in it. Still, I have
to agree that there are edges (like these) that must be sharpened out...

On 7/24/06, paul kölle <paul at subsignal.org> 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). 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.
>
> Yes docstrings are nice but sometimes a simple:
>
> foo(int:param1, string:param2) is way better than:
>
> foo(param1, param2):
>   """
>   @type param1: integer
>   @type parame2: string
>   """
>
> cheers
> Paul
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
GPG Fingerprint: B0D7 1249 447D F5BB 22C5  5B9B 078C 2615 504B 7B85
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060724/7a84364b/attachment.html>


More information about the Python-list mailing list