Been trying migtily to get a grip on python: multipurpose language,
object-oriented, blah, blah. Then I saw a quote from G van Rossum wherein
he said he had developed python to faciitate working with data. That
makes sense.
C is arguably the fastest language to get things done, but it is long-winded and tedious
to write. python is breezy but its interpreter is written is C, so it will take comparatively
longer to execute. The interpreter translates python code to bytecode, which then
runs on a virtual machine. Re bytecode:
'Byte code is an intermediate code between the source code and machine code. It is a low-level code that is the result of the compilation of a source code which is written in a high-level language. It is processed by a virtual machine like Java Virtual Machine (JVM).
Byte code is a non-runnable code after it is translated by an interpreter into machine code then it is understandable by the machine. It is compiled to run on JVM, any system having JVM can run it irrespective of their operating system. That’s why Java is platform-independent. Byte code is referred to as a Portable code.'
Geeks for Geeks
As for what lives where, Python3.9 comes with libraries. Modules are functions, groups of
related modules are packages, and packages travel as librairies. A package has an __init__
functionthat calls the appropriate module. Pip install will make move a module's contents
to an easily accessible file.
As an exercise, I am importing the sys module and asking for a print of sys.path. i will see
where the machine will look for sys functionality as needed:
No comments:
Post a Comment