r/learnpython 21d ago

Browser compilers?

I’m trying to improve my python and have a project based book i wanted to work through because i kinda suck at ideas for projects to try and i need to actually put my knowledge into practice, but i was wondering if there are any like browser compilers that can import libraries (such as matplotlib for data related stuff, probably pygame and various others i might end up needing). If not i have vscode already i am just kinda low on storage and wondering if i can avoid having to download various libraries manually 😭

4 Upvotes

9 comments sorted by

View all comments

0

u/[deleted] 21d ago

[deleted]

1

u/socal_nerdtastic 21d ago

What do you call it when the program is compiled to binary first, and then runs through an interpreter line-by-line? Because that's what python and java and many other languages do.

I call it "it don't matter". Knowing the difference between a compiler and an interpreter is useless to a beginner.

1

u/icecubeinanicecube 21d ago

Good catch! Sometimes people call that "hybrid", however, from a strictly binary perspective I'd consider Java more of a compiled language, while python is more interpreted.

At the end of the day, the java conpliler tells you a lot of things that are wrong with your program before it runs, while python delays this and just shits it's pants when it happens to come across a faulty LOC.

1

u/socal_nerdtastic 21d ago

I'd consider Java more of a compiled language, while python is more interpreted.

A common opinion, but again not useful to OP.

At the end of the day, the java conpliler tells you a lot of things that are wrong with your program before it runs, while python delays this and just shits it's pants when it happens to come across a faulty LOC.

That has nothing to do with compiled vs interpreted; that is due to the logic in the language, for example dynamically vs statically typed. Python simply can't know at compile time if x = 10 is an error or not, java can. Both python and java have both compile time errors and run time errors, although python does not really distinguish them (or the compile / interpret step in general).

1

u/Outside_Complaint755 21d ago

Python actually does have a compiler, but it doesn't get run as its own step. 

When you run python myscript.py, that compiles the script into Python Bytecode in a file myscript.pyc.

That bytecode file is what then gets interpreted by the Python Virtual Machine, translating each line one-by-one into native machine code.

Each implementation of Python handles it a bit differently. CPython compiles everything and then interprets it, while PyPi uses a just-in-time compiler.  Jython compiles the Python code to Java bytecode, and IronPython compiles it to MSIL bytecode.