0% found this document useful (0 votes)
16 views23 pages

Why Python For DLT

The document outlines key features of Python, including rapid development, automatic memory management, and support for object-oriented programming. It explains the concept of modules, how they can be imported and used, and introduces packages with dotted module names. Additionally, it provides a simple example of a TensorFlow program demonstrating basic functionality.

Uploaded by

suganyad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views23 pages

Why Python For DLT

The document outlines key features of Python, including rapid development, automatic memory management, and support for object-oriented programming. It explains the concept of modules, how they can be imported and used, and introduces packages with dotted module names. Additionally, it provides a simple example of a TensorFlow program demonstrating basic functionality.

Uploaded by

suganyad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

([email protected].

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

You might also like