Hacker News new | ask | show | jobs
by rahimiali 1526 days ago
> "What you really want is a compiler, isn’t it?"

The thing is, Python is just as compiled as, say Java. Python converts your code to byte code, then executes that bytecode in its VM. These are the same steps Java takes.

So this "whoops" doesn't work for me: "Some language that’s as easy to use as Python and it should be compiled and with good static typing, but it should also not be compiled because then it wouldn’t be as easy to use as Python anymore. Whoops?".

The reason the typing in Python is lax was entirely a choice. Maybe not a good choice, but it certainly has nothing to do with "compiled" vs "interpreted".

2 comments

That's not really a good definition of compiled. Interpreted vs compiled is very much more a continuum than it was however many years ago when these terms originated - you had compiled ALGOL and interpreted BASIC, and little in between.

Rather, you have to look at it like an attribute based categorization:

Compiled:

- types known at compile time

- limited runtime features like stack traces, introspection

- working closer to primitive data types

Interpreted:

- dynamic, with lots of indirection

- wrapped data types (eg PyObject) vs primitives

- rich runtime with stack traces, introspection, monkey patching

There is mypyc and Cython, which compile Python to high performance machine code.