Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
REPL
#1
Hi,

The Python REPL is it an interpreter or a compiler?

When I have a file, let's say test.py and when I type, python test.py at the command prompt, the file get's compiled into byte code and then gets executed by the PVM.

But the same code if I input via the REPL, does it still compile and then execute or does it interpret line by line and execute?

Please clarify.

Thanks
Reply
#2
When you type code in the REPL, each python statement is compiled into bytecode individually and this small bytecode is immediatly executed. Of course these statements can span multiple lines for example if you're writing a loop or a function definition.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  help for use print in REPL jip31 10 4,123 Apr-30-2021, 03:52 PM
Last Post: bowlofred
  Using my REPL to bisect numbers and lists with classes (PyBite #181) Drone4four 2 2,005 Sep-24-2020, 01:47 PM
Last Post: Drone4four
  Using matplotlib in Spyder v/s REPL peterjv26 2 2,519 Jul-04-2020, 10:57 AM
Last Post: snippsat
  Online python repl? Gribouillis 4 33,043 Apr-09-2020, 12:19 PM
Last Post: Gribouillis
  Embedding or adding IDE like "repl" inside Flask app sray 1 2,189 Jul-03-2019, 03:13 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020