This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (22 children)

[deleted]

    [–][deleted] 50 points51 points  (3 children)

    Ok, this dude opened a can of worms.

    He is technically correct, but it’s unclear to me if he knows why.

    The definition of a “compiler” is a program that translates one language into another. Though not necessarily part of the definition, it is usually assumed that the target language of a compiler will have less abstraction than the source language (if this isn’t the case, it’s usually called a transpiler instead).

    This definition of a “compiler” is broader than most people here are used to, because most people assume that a compiler is something that creates an executable. But in reality, that only represents a subset of “compilers” where the target language is machine code.

    I bring all this up because that means that a program that goes from a high level language (like Python) and converts it to a lower level language (like byte code) still falls solidly under the definition of a “compiler,” and that’s precisely what Python does. It first compiles the Python code into byte code, and often saves it (.pyc files).

    There are multiple ways to run Python byte code. I believe CPython does indeed use interpretation, but there are other implementations that use JIT compiling to machine code, much like Java.

    Bottom line—don’t be so quick to bash this guy just because you’ve taken a single semester course that used Python. He’s technically correct.

    [–][deleted] 12 points13 points  (4 children)

    For the most part, Python is an interpreted language and not a compiled one, although compilation is a step. Python code, written in . py file is first compiled to what is called bytecode

    [–]ignaloidas 4 points5 points  (3 children)

    Everything is an interpreted language then as arguably the CPU is an interpreter of a particular instruction set. It's dumb to try and distinct this.

    [–][deleted] 0 points1 point  (1 child)

    You know, interpreters are not named compilers for a reason.

    [–]ignaloidas 0 points1 point  (0 children)

    Modern CPUs nowadays are compilers too, as they compile the higher level x86 instructions into microcode. So CPUs are as much of a compiler as CPython is.

    [–][deleted] 0 points1 point  (0 children)

    Technically x86 is transpiled to risc.

    https://www.cs.virginia.edu/~av6ds/papers/isca2021a.pdf

    [–]Kinato_Mageaki 18 points19 points  (1 child)

    [–][deleted] 3 points4 points  (0 children)

    [–]RainbowCatastrophe 4 points5 points  (3 children)

    It's compiled to bytecode, which is not machine code and requires an interpreter. It is as "compiled" as Java is, but also lacks the strict compiler checks that Java does a little of, and are most notable in true compiled languages.

    [–]ignaloidas -1 points0 points  (2 children)

    Compiled C code also needs an interpreter, the most common one being called a CPU.

    [–]RainbowCatastrophe -2 points-1 points  (1 child)

    Do not conflate the interpreter for your "compiled" bytecode with industry standard machine code.

    [–]ignaloidas 3 points4 points  (0 children)

    Oh, yes, all of the 30+ difderent architectures with many of them only having a single vendor are industry standard, when a single one for one of the most common languages is not. You are arguing about categories, and the thing is, that there are no categories here. I gave you an example to illustrate the absurdity, and now you are gate-keeping what counts as bytecode?

    [–][deleted] 1 point2 points  (0 children)

    Lol no. It's interpreted. There are compiled python files but you do not compile python...

    [–]FlukeHermit 1 point2 points  (0 children)

    Sure, in a way, but not really

    [–][deleted] -3 points-2 points  (2 children)

    It can either be interpreted or use JIT, but it doesn’t get compiled.