Type signature

Paddy paddy3118 at netscape.net
Sun Jul 23 04:17:26 EDT 2006


Yacao Wang wrote:
> Hi, I'm a newbie to Python. I've recently read some books about this
> language and none of them have answered my question.
> As a dynamically-typed language Python doesn't need any form of type
> signature which makes the syntax very clean and concise. 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, and
> sometimes it is still difficult to extract the above information even if the
> implementation is available. Haskell can also determine type information
> dynamically, but it still supports and recommends the programming style with
> type signatures, which makes the code very readable and maitainable. As I
> understand, Python relies too much on run-time type-checking, that is,
> whenever you give the wrong type, you just end up with an exception, which
> is logically correct, but not that useful as type signatures.
> Any ideas on this issue?
>
> --
> Alex
>
Hi Yacao/Alex,
Try these:
  "How to duck type? - the psychology of static typing in Ruby"
   http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/100511
  "3-31-04 I'm Over It"

http://66.102.9.104/search?q=cache:6XW473VSflcJ:www.mindview.net/WebLog/log-0053+%2B%22duck+typing%22+%2B+%22static+typing%22+%2Bpython&hl=en&gl=uk&ct=clnk&cd=3&client=firefox-a

It seems that the latent or duck typing, used in dynamic languages is
counter-intuitve to  those from a static typing background.
Nevertheless, it does work, and work well.
- Paddy.




More information about the Python-list mailing list