learning python - part 1

22
Learning Python Part 1 | Winter 2014 | Koosha Zarei | QIAU

Upload: koosha-zarei

Post on 03-Sep-2014

148 views

Category:

Software


1 download

DESCRIPTION

Learning python series based on "Beginning Python Using Python 2.6 and P - James Payne" book presented by Koosha Zarei.

TRANSCRIPT

Page 1: Learning python - part 1

Learning PythonPart 1 | Winter 2014 | Koosha Zarei | QIAU

Page 2: Learning python - part 1

Part 1

Page 3: Learning python - part 1

3February 2014Learning Python | Part 1 | Koosha Zarei

ReferencesWhat is Python?Why Python?What can we do with Python?What is the downside?Who use Python?Alternative ImplementationsInstallation and ConfigurationModule, File, and ScriptHow to run programsDebugging Python CodeUseful Links

Content

Page 4: Learning python - part 1

4February 2014Learning Python | Part 1 | Koosha Zarei

RefereesLearning Python, Fourth Edition, Mark Lutz, 2009, O’Reilly Media, Inc.Beginning Python® Using Python 2.6 and Python 3.1, James Payne, Wiley Publishing, Inc.

Python.org

Page 5: Learning python - part 1

5February 2014Learning Python | Part 1 | Koosha Zarei

What is Python?Python

Is a General Purpose ,High Level Programming Language.Supports multiple programming paradigms. Features a dynamic type system.Support Automatic memory management.Contains Large and comprehensive standard library.

Page 6: Learning python - part 1

6February 2014Learning Python | Part 1 | Koosha Zarei

Why Python?Software quality.

Readability, maintainability.

Developer productivity.Less to type, less to debug, and less to maintain.No compile, No Linking step.

Program portability.Cross platform.

Support libraries.

Page 7: Learning python - part 1

7February 2014Learning Python | Part 1 | Koosha Zarei

Why Python?Component integration.

C, C++, .NET, XML.

Enjoyment.Built-in tool-set.

English keywords.Small core, large standard library, and an easily extensible interpreter.

Page 8: Learning python - part 1

8February 2014Learning Python | Part 1 | Koosha Zarei

Why Python?High level dynamic data type.Automatic memory management.Free and Open Source.GUI support.

Python is commonly defined as an object-oriented scripting language.

Page 9: Learning python - part 1

9February 2014Learning Python | Part 1 | Koosha Zarei

What can we do with Python?GUI.Systems Programming.Database Programming.Internet Scripting.Numeric & Scientific Programming.Natural Language Analysis.Rapid Prototyping.Gaming, Images, Serial Ports, XML, Robots, and more.

Page 10: Learning python - part 1

10February 2014Learning Python | Part 1 | Koosha Zarei

What is the downside?Execution Speed

Execution speed may not always be as fast ascompiled languages such as C and C++.

Source Code Byte Code Interpreter

Page 11: Learning python - part 1

11February 2014Learning Python | Part 1 | Koosha Zarei

Who use Python?1 million users.Google, YouTube, BitTorrent.Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM.Industrial Light & Magic, Pixar.NASA, Los Alamos, Fermilab and JPL.

Page 12: Learning python - part 1

12February 2014Learning Python | Part 1 | Koosha Zarei

Alternative Implementations

Three Primary ImplementationCpython

Original, Reference and standard.Jython

JavaIronPython

.NET framework

All implement the same Python language but execute programs in different ways

Page 13: Learning python - part 1

13February 2014Learning Python | Part 1 | Koosha Zarei

Installation and ConfigurationPre-installed on various OS:

Linux: Python 2.Mac OS X: Python 2.Windows: noting!

Download from official website.

'Python -V'Shows version of installed python

Learning Python, Mark Lutz, APPENDIX A

Page 14: Learning python - part 1

14February 2014Learning Python | Part 1 | Koosha Zarei

Module, File, and ScriptModules:

Text files containing python statements.Ready to execute any number of time and in a variety of ways.Module files are often referred to as programs.Module files that are run directly are also sometimes called scripts.File(s) imported from another file.Packages of additional tools.

Page 15: Learning python - part 1

15February 2014Learning Python | Part 1 | Koosha Zarei

How to run programsI. The Interactive PromptII.Running Files with Command LinesIII.The IDE User Interface

Page 16: Learning python - part 1

16February 2014Learning Python | Part 1 | Koosha Zarei

How to run programsThe Interactive Prompt

Simplest wayExperimentingTestingLinux

Just type PythonWindows

Start IDLE’s main windowSelect “Python (command line)”

/usr/local/bin/python/usr/bin/python

C:\Python30\python

Page 17: Learning python - part 1

17February 2014Learning Python | Part 1 | Koosha Zarei

How to run programs

Page 18: Learning python - part 1

18February 2014Learning Python | Part 1 | Koosha Zarei

How to run programsRunning Files with Command Lines

Execute python command in terminal by passing the script name.

Run Python Scripts: “python script.py”

Some basic information about command:python -h

Page 19: Learning python - part 1

19February 2014Learning Python | Part 1 | Koosha Zarei

How to run programsThe IDE User Interface

Integrated Development Environment, Binds together various development tasks into a single view.IDLE

Python program that uses the standard library’s tkinter GUI toolkit to build the IDLE GUI.

Eclipse and PyDev.Komodo.NetBeans IDE for Python.PythonWin.Anjuta.

Page 20: Learning python - part 1

20February 2014Learning Python | Part 1 | Koosha Zarei

How to run programsThe IDE User Interface

Features:For Authoring, Modifying, Deploying, and Debugging.Interactive debuggerIntegrated compiler/interpreterCode completionProject managementVersion control

Wikipedia | More info about IDE

Page 21: Learning python - part 1

21February 2014Learning Python | Part 1 | Koosha Zarei

Debugging Python CodeStrategies for debugging Python:

Do Nothing!Python interpret shows very useful error message facing mistakes by default.

PrintFast execution.

IDE DebuggerTrace code in more detail.

pdbAvailable as a module in Python's standard library.

Page 22: Learning python - part 1

22February 2014Learning Python | Part 1 | Koosha Zarei

Useful Linkspyvideoshowmedo.combestechvideos.comtutorialspoint.com