News for hackers. Stuff that matters.
Re:Why Python is Slow: Looking Under the Hood by lispm on Saturday May 10, 2014 @03:58AM (#7724804)
If you use a language with type inference, you won't see what it returns either. Because it is not in the code. You would need an IDE which finds it out.

Sometimes it computes a type and you have no idea what the type is about.

Also dynamic typing does not mean you don't know what a function receives or returns. Many dynamically typed languages are object oriented and use classes.

For example in Lisp I would write:

    (defmethod collide ((s1 ship) (s2 submarine))
      ...
      (the collision-event (make-collision-event ...)))
Then I know that the arguments are objects of class ship and submarine and it returns an collision-event.

It's not statically typed, but the code is nicely readable and testable.

Re:Why Python is Slow: Looking Under the Hood by benjiweber on Saturday May 10, 2014 @05:24AM (#7724916)
With inferred types you still know that callers must be passing something for which the operations performed are valid.

Many languages allow you to specify types even when they may be inferred to add clarity/preconditions. This is useful for modelling the domain as well as local reasoning. Perhaps the current implementation is valid for all integers, but in the domain context it only makes sense for the range 0-100.

Re:Why Python is Slow: Looking Under the Hood by nly on Saturday May 10, 2014 @07:33AM (#7725091)
If the compiler can infer the type locally then so can I. At least for reasonably well structured code.
Re:Why Python is Slow: Looking Under the Hood by cousin_it on Saturday May 10, 2014 @08:39AM (#7725186)
I thought type inference in Haskell or ML was a global algorithm.