Open Source Software: Programming in Python

[Pages:67]Open Source Software:

Programming in Python





CS360

10/31/16

Pacific University

1

Who uses Python?

What functionality is available?

Python + SDL

Two versions: 2.7 vs 3.x







CS360

10/31/16

Pacific University

2

What's a scripting language?

About

? why is python useful? / who uses it?

nice interactive interpreter

Rich standard library & PyPI (package index)

Data Structures

? lists / dictionaries / sets / iterators

object oriented

? yield/generator/iterator

uses garbage collection

can treat a function as an object

duck typing (dynamic typing)

pip/ dev tools: pydoc/docstring/debugger/unittest Guido van Rossum



CS360

10/31/16

Pacific University

3

Scripting Language

What is a scripting language?

Why would you use one?

Do you really not compile the code?

? interpreter vs compiler vs byte code & Virtual Machine



CS360

10/31/16

Pacific University

4

Workflow (Linux)

edit myCode.py chmod u+x myCode.py

myCode.py #!/usr/bin/python3

print ("TEST")

./myCode.py

OR

student@linux-9j27:~> python3 Python 3.4.1 ... Type "help", "copyright", ... >>> print ("TEST") TEST >>>

CS360

10/31/16

Pacific University

5

Workflow - Editors

Command line

GUI

? ipython ? python

? Eclipse

pydev plugin LiClipse: $$$

? Geany ? Jupyter Notebook (previously IPython Notebook)

CS360

10/31/16

Pacific University

6

Install ? Python 3.X

Windows or Mac

? ? Mac: Homebrew

Linux

? via package manager

? yum, apt-get, zypper/yast ....

ipython

? better Python shell



IDLE

? GUI version of the Python shell

Source

? the source code is also available

pip

Python Software

? install and manage Python packages pip3 install virtualenvwrapper

list packages

virtual environments

cd ~ virtualenv-3.4 CS360_python source CS360_python/bin/activate pip3 install simplejson pip3 install ipython pip3 install "ipython[notebook]" pip3 install jupyter pip3 freeze deactivate





................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download