in)
Python Features
no compiling or linking rapid development cycle
no type declarations simpler, shorter, more flexible
automatic memory garbage collection
management
high-level data types and fast development
operations
object-oriented programming code structuring and reuse
embedding and extending in C mixed language systems
classes, modules, exceptions "programming-in-the-large"
support
dynamic loading of C modules simplified extensions, smaller
binaries
dynamic reloading of C programs can be modified
modules without stopping
What are Modules?
Modules are files containing Python
definitions and statements along with
function definitions
(ex. name.py)
A module’s definitions can be imported into
other modules by using “import name”
The module’s name is available as a global
variable value
To access a module’s functions, type
“name.function()”
More on Modules
Each module has its own private symbol table
used as the global symbol table by all functions in
the module
Modules can import other modules
Each module is imported once per interpreter
session
reload(name)
Can import names from a module into the
importing module’s symbol table
from mod import m1, m2 (or *)
m1()
Packages
“dotted module names” (ex. a.b)
Submodule b in package a
Users of the package can import individual
modules from the package
Ways to import submodules
import sound.effects.echo
from sound.effects import echo
Submodules must be referenced by full name
An ImportError exception is raised when the
package cannot be found
Ex 1:
http://docs.python.org/tutorial/modules.html
Tensorflow – simple Hello
world program
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Every Accomplishment starts with a decision to try