Lecture#2
.pdfHigh performance computing for non-programmers
Glib Ivashkevych
junior researcher, NSC KIPT
Lecture #2:
Python programming language: Overview
cross-platform simple to learn general-purpose flexible & extendable
Huge standard library
Tons of third-party packages Documentation
Is used for:
scripting in VFX science & engineering system administration
Youtube, Google, Instagram, DropBox NASA, CERN
Philips, ILM and more
In computing:
glue layer GUI
code generation & prototyping
Python has a lot of tools for scientific computing: NumPy, SciPy, SymPy, scikit-learn
Scripting Compiled
language instructions are |
language instructions are |
executed one by one |
compiled to assembly |
flexible, but slow |
rigid, but fast |
allow for very fast |
development cycle is usually |
development cycle |
longer |
perfect for |
perfect for |
complex automation |
performance |
How Python code is executed
execution
|
“compilation” |
Python |
file.py |
file.pyc |
Virtual |
|
|
Machine |
source
code bytecode
Python type system
Dynamic,
variables are references
no definitions, created automatically
but strong typing
objects have type
+ garbage collector
x == y |
x is y |
x
“some string”
y
True True
x == y |
x is y |
x
y
“some string”
“some string”
True False
Mutable vs Immutable
Mutable objects can be changed lists, dictionaries, sets, byte arrays
can be changed in-place
Immutable objects can not be changed once created
numbers, strings, tuples
new object is created at each reassignment