Modules and Packages. CS 339R (Python) Chapter 8

Size: px
Start display at page:

Download "Modules and Packages. CS 339R (Python) Chapter 8"

Transcription

1 Modules and Packages CS 339R (Python) Chapter 8 Spring 2011

2 Loading a Module The import statement: Reads the source file Creates a module object in the current scope Executes all top-level statements You can put any module initialization code at module scope All top-level definitions become attributes of the module object And are considered global to the module Modules are only imported once per scope Subsequent imports of the same module are ignored 2

3 Renaming Module Objects Use the import as feature Only the local module object takes the new name Handy for selecting the appropriate module at runtime if format == 'xml': import xmlreader as reader elif format == 'csv': import csvreader as reader data = reader.read_data(filename) 3

4 Import Selected Features from <module> import <symbols> The symbols are added to the current scope So you don t have to say <module>.<symbol> Import all symbols with *! (use sparingly) from spam import foo # Imports spam and puts 'foo' in current namespace foo() # Calls spam.foo() from spam import baz as f f(1) # Calls spam.baz(1) from bar import * # all bar s names are now local See mymod.py 4

5 Restricting import * You can choose from within a module what gets imported with an import * Place the desired names to export in a list named all at module scope # module: spam.py # Names I will export with from spam import * all = ['bar', 'Spam'] 5

6 Don t Forget Scope Rules # In spam.py: a = 37 # spam.a def foo(): print "I'm foo and a is",a # In a client module: from spam import a, foo # Import a global variable a = 42 # Modify main.a only foo() # Prints "I'm foo and a is 37" print a # Prints "42" The global namespace for a function is always the module in which the function was defined, not the namespace into which a function is imported and called. 6

7 The Module Search Path >>> import sys >>> print sys.path ['', '/Library/Frameworks/Python.framework/Versions/2.7/lib/ python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/ lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/ lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/ Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/ Python.framework/Versions/2.7/lib/python2.7/plat-mac/libscriptpackages', '/Library/Frameworks/Python.framework/Versions/ 2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/ Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/ Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/ Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ site-packages'] 7

8 Changing the Module Search Path It s just a list You can append to it: sys.path.append( /User/chuck/UVU/mydir ) You can also set the PYTHONPATH environment variable prepends to sys.path 8

9 Searching Zip Files Zip files can also go into the module search path They behave as if they were directories In the example below, the file archive.zip contains the file prod_cons.py (Homework 4) >>> import sys >>> sys.path.append('archive.zip') >>> import prod_cons A BBB EEEEEE F G Z Y W P Q R ABB BEE EEE E F GZY W PQ R >>> dir(prod_cons) [' builtins ', ' doc ', ' file ', ' loader ', ' name ', ' package ', 'consume', 'p', 'produce', 's'] 9

10 Running Modules from the Search Path Use the -m option It finds the module via sys.path, and runs it as the main module dhcp :339r chuck$ python cprofile.py perfect.py /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'cprofile.py': [Errno 2] No such file or directory dhcp :339r chuck$ dhcp :339r chuck$ python -m cprofile perfect.py function calls in seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) perfect.py:1(<module>) perfect.py:1(perfect) {method 'disable' of '_lsprof.profiler' objects} {range} {sum} 10

11 Packages Hierarchies of Modules Created by a tree of directories Each directory must have an init.py You can import an intermediate subdirectory import foo.bar Modules foo and foo.bar are created Objects defined in the init.py files are bound to their module objects 11

12 A Sample Package foo # foo/bar/baz.py name = "joe" print 'foo/bar/baz.py' bar bar2 baz.py Each.py file has a trace print statement >>> import foo.bar.baz foo/ init.py foo/bar. init.py foo/bar/baz.py >>> import foo.bar2 foo/bar2/ init.py >>> print foo.bar.baz.name joe 12

13 Package-Relative Imports Allows importing modules in the same package with UNIX-style relative directory syntax (without slashes) from. import lines!!!!! # import child module from..primitive import shape!! # import sibling module Only allowed in packages Only allowed with from... import... style syntax 13

14 Importing An Entire Package You must arrange for each submodule to import its children See foo2 package 14

15 Reminder: about main If a module is loaded at the top level (when launching python), its module name is main You can then test to know whether a module is the top one: if name == main : # Loaded as top-level (perform module test code)... else: # imported from another module (usually do nothing here) 15

16 Packages and main You can have a main module for a package Formed differently than the if name == main method Runs whenever you execute the package from the command-line: python foo python table2 It will load and execute the module in file main.py in the foo directory Ditto for Zip files Beware directory dependencies (may need to alter sys.path or use os.path.chdir) 16

17 Distributing Applications Use the distutils module for typical Python distributions First place your files in a directory Then include a setup.py file there Then call: python setup.py sdist!! # For a source distribution python setup.py bdist!! # For.pyc distribution 17

18 Installing a Distribution Unzip the distribution file Run python setup.py install in the distribution s root directory The module/package is added to your site-packages directory See table2 example 18

19

Lecture 4. Introduction to Python! Lecture 4

Lecture 4. Introduction to Python! Lecture 4 Lecture 4 Introduction to Python Lecture 4 Summary Modules (general things) Using modules Importing modules Standard Library modules Modules search path Import modules phases Packages Organizing Python

More information

Introduction. HPC Python. Cyrus Proctor January 23th, 2015

Introduction. HPC Python. Cyrus Proctor January 23th, 2015 Introduction HPC Python Cyrus Proctor cproctor@tacc.utexas.edu January 23th, 2015 Why Python Easy! Nice, readable code Great for prototyping Many third party libraries Large community base Free! C. Proctor

More information

Workshop on Advanced Techniques for Scientific Programming and Management of Open Source Software Packages Gravitation Project

Workshop on Advanced Techniques for Scientific Programming and Management of Open Source Software Packages Gravitation Project Workshop on Advanced Techniques for Scientific Programming and Management of Open Source Software Packages Gravitation Project Bellomo, Franco @fnbellomo Aguena da Silva, Michel Fogliatto, Ezequiel Romero

More information

CS Programming Languages: Python

CS Programming Languages: Python CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer

More information

Babes-Bolyai University

Babes-Bolyai University Babes-Bolyai University arthur@cs.ubbcluj.ro Overview 1 Modules programming - a software design technique that increases the extent to which software is composed of independent, interchangeable components

More information

Lessons on Python Modules and Packages

Lessons on Python Modules and Packages Lessons on Python Modules and Packages Walter Didimo [ 60 minutes ] Programs so far So far we have written and tested simple programs in one of the two following ways: using the Python interactive mode

More information

Data type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays.

Data type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays. NETB 329 Lecture 4 Data Structures in Python Dictionaries Data type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays. 1 of 70 Unlike

More information

Import That! Import Basics. I have a small confession: I often think that I don t fully understand the Python

Import That! Import Basics. I have a small confession: I often think that I don t fully understand the Python Import That! DAVID BEAZLEY David Beazley is an open source developer and author of the Python Essential Reference (4th Edition, Addison-Wesley, 2009). He is also known as the creator of Swig (http://www.swig.org)

More information

What s slow? Tools and Stories from Within Yelp s Infrastructure. Arnaud Brousseau Berkeley, 9/7/2017

What s slow? Tools and Stories from Within Yelp s Infrastructure. Arnaud Brousseau Berkeley, 9/7/2017 What s slow? Tools and Stories from Within Yelp s Infrastructure Arnaud Brousseau Berkeley, 9/7/2017 Pro g n i l i f Tracing Caution Our agenda today! Profiling Image credits: Pion Kim What s profiling?

More information

ECE 364 Software Engineering Tools Lab. Lecture 8 Python: Advanced I

ECE 364 Software Engineering Tools Lab. Lecture 8 Python: Advanced I ECE 364 Software Engineering Tools Lab Lecture 8 Python: Advanced I 1 Python Variables Namespaces and Scope Modules Exceptions Lecture Summary 2 More on Python Variables All variables in Python are actually

More information

Modules and Programs 1 / 14

Modules and Programs 1 / 14 Modules and Programs 1 / 14 Python Programs Python code organized in modules, packages, and scripts. We ve already used some modules, now we ll learn what they are, how they re orgainized in packages,

More information

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes GIS 4653/5653: Spatial Programming and GIS More Python: Statements, Types, Functions, Modules, Classes Statement Syntax The if-elif-else statement Indentation and and colons are important Parentheses and

More information

Writing Python Libraries. Import Statements and Packaging

Writing Python Libraries. Import Statements and Packaging Writing Python Libraries Import Statements and Packaging Basics A Python file is called either a script or a module, depending on how it s run: Script: Run file as a top-level script - python file.py -

More information

An Introduction to Python

An Introduction to Python An Introduction to Python Day 2 Renaud Dessalles dessalles@ucla.edu Python s Data Structures - Lists * Lists can store lots of information. * The data doesn t have to all be the same type! (unlike many

More information

Bentley Map Geospatial Administrator Workspace Base Source Directory and Files Node

Bentley Map Geospatial Administrator Workspace Base Source Directory and Files Node Bentley Map Geospatial Administrator Workspace Base Source Directory and Files Node The Geospatial Administrator provides expected flexibility to define and customize your Bentley Map projects. This includes

More information

Python Optimization and Integration

Python Optimization and Integration [Software Development] Python Optimization and Integration Davide Balzarotti Eurecom Sophia Antipolis, France 1 When Python is not Enough Python is great for rapid application development Many famous examples...

More information

PTN-202: Advanced Python Programming Course Description. Course Outline

PTN-202: Advanced Python Programming Course Description. Course Outline PTN-202: Advanced Python Programming Course Description This 4-day course picks up where Python I leaves off, covering some topics in more detail, and adding many new ones, with a focus on enterprise development.

More information

Installing Python Modules Release 2.5.2

Installing Python Modules Release 2.5.2 Installing Python Modules Release 2.5.2 Greg Ward 21st February, 2008 Python Software Foundation Email: distutils-sig@python.org Abstract This document describes the Python Distribution Utilities ( Distutils

More information

MicroPython Basics: Load Files & Run Code

MicroPython Basics: Load Files & Run Code MicroPython Basics: Load Files & Run Code Created by Tony DiCola Last updated on 2017-01-26 09:19:24 PM UTC Guide Contents Guide Contents Overview Install ampy Upgrade Ampy Source Install Disable ESP8266

More information

Using Scala in CS241

Using Scala in CS241 Using Scala in CS241 Winter 2018 Contents 1 Purpose 1 2 Scala 1 3 Basic Syntax 2 4 Tuples, Arrays, Lists and Vectors in Scala 3 5 Binary output in Scala 5 6 Maps 5 7 Option types 5 8 Objects and Classes

More information

Getting Started with Command Prompts

Getting Started with Command Prompts Getting Started with Command Prompts Updated December, 2017 Some courses such as Java Programming will ask the student to perform tasks from a command prompt (Windows) or Terminal window (Mac OS). Many

More information

PeopleEnroll v3.1 Installation and Configuration Guide

PeopleEnroll v3.1 Installation and Configuration Guide PeopleEnroll v3.1 Installation and Configuration Guide Instructions to Install and Configure PeopleEnroll v3.1 Web Active Directory, LLC Contents Overview... 2 Installation Support... 2 System Requirements...

More information

Modules and scoping rules

Modules and scoping rules C H A P T E R 1 1 Modules and scoping rules 11.1 What is a module? 106 11.2 A first module 107 11.3 The import statement 109 11.4 The module search path 110 11.5 Private names in modules 112 11.6 Library

More information

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D 1/58 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.

More information

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D 1/60 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.

More information

Modules and Packages for Code Reuse

Modules and Packages for Code Reuse Modules and Packages for Code Reuse Up until this chapter, we have been looking at code at the level of the interactive console and simple scripts. This works well for small examples, but when your program

More information

Tissu for Fabric Documentation

Tissu for Fabric Documentation Tissu for Fabric Documentation Release 0.1-alpha Thierry Stiegler July 17, 2014 Contents 1 About 1 1.1 Installation................................................ 1 1.2 Quickstart................................................

More information

CPSC 217 Midterm (Python 3 version)

CPSC 217 Midterm (Python 3 version) CPSC 217 Midterm (Python 3 version) Duration: 60 minutes 7 March 2011 This exam has 81 questions and 14 pages. This exam is closed book. No notes, books, calculators or electronic devices, or other assistance

More information

The Python Journeyman

The Python Journeyman The Python Journeyman Robert Smallshire and Austin Bingham This book is for sale at http://leanpub.com/python-journeyman This version was published on 2018-01-02 ISBN 978-82-93483-04-5 This is a Leanpub

More information

Table of Contents EVALUATION COPY

Table of Contents EVALUATION COPY Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...

More information

RAVE Administrator s Guide

RAVE Administrator s Guide RAVE Administrator s Guide Phil Groce CERT Network Situational Awareness Group April 27, 2007 Contents I Introduction 2 1 About this document 2 2 Additional Information 2 II Installing RAVE 2 3 Requirements

More information

Lists, loops and decisions

Lists, loops and decisions Caltech/LEAD Summer 2012 Computer Science Lecture 4: July 11, 2012 Lists, loops and decisions Lists Today Looping with the for statement Making decisions with the if statement Lists A list is a sequence

More information

Experiences with using Python in Mercurial

Experiences with using Python in Mercurial Experiences with using Python in Mercurial Martin Geisler mg@aragost.com Python Geek Night November 16th, 2010 About the Speaker Martin Geisler: core Mercurial developer: reviews patches from the community

More information

Part IV. More on Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,

Part IV. More on Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26, Part IV More on Python Compact Course @ Max-Planck, February 16-26, 2015 36 More on Strings Special string methods (excerpt) s = " Frodo and Sam and Bilbo " s. islower () s. isupper () s. startswith ("

More information

CS S-02 Python 1. Most python references use examples involving spam, parrots (deceased), silly walks, and the like

CS S-02 Python 1. Most python references use examples involving spam, parrots (deceased), silly walks, and the like CS662-2013S-02 Python 1 02-0: Python Name python comes from Monte Python s Flying Circus Most python references use examples involving spam, parrots (deceased), silly walks, and the like Interpreted language

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS 164 Spring 2005 P. N. Hilfinger Project #2: Static Analyzer for Pyth Due: Wednesday, 6 April

More information

TU Dresden: A Large-Scale Plone Deployment Case Study

TU Dresden: A Large-Scale Plone Deployment Case Study Media Center TU Dresden: A Large-Scale Plone Deployment Case Study Dresden, 10/20/17 Motivation There is no real new stuf here Provide feedback to the wider Plone community 2/38 Starting Point 3/38 Starting

More information

CSE : Python Programming

CSE : Python Programming CSE 399-004: Python Programming Lecture 2: Data, Classes, and Modules January 22, 2007 http://www.seas.upenn.edu/~cse39904/ Administrative things Teaching assistant Brian Summa (bsumma @ seas.upenn.edu)

More information

CS 105 Perl: File I/O, slices, and array manipulation

CS 105 Perl: File I/O, slices, and array manipulation CS 105 Perl: File I/O, slices, and array manipulation Nathan Clement January 27, 2013! Agenda Intermediate iteration last and next Intermediate I/O Special variables Array manipulation push, pop, shift,

More information

FROM SCRIPT TO PACKAGES. good practices for hassle-free code reuse

FROM SCRIPT TO PACKAGES. good practices for hassle-free code reuse FROM SCRIPT TO PACKAGES good practices for hassle-free code reuse WHAT S THIS TUTORIAL IS ABOUT How to make your code usable by someone else WHO AM I? Contributor to numpy/scipy since 2007 Windows, Mac

More information

Programming in Python Advanced

Programming in Python Advanced Programming in Python Advanced Duration: 3 days, 8 hours a day Pre-requisites: * Participants should be comfortable with the following technologies: Basic and working knowledge of the Pyton If new to the

More information

$Id: asg4-shell-tree.mm,v :36: $

$Id: asg4-shell-tree.mm,v :36: $ cmps012b 2002q2 Assignment 4 Shell and Tree Structure page 1 $Id: asg4-shell-tree.mm,v 323.32 2002-05-08 15:36:09-07 - - $ 1. Overview A data structure that is useful in many applications is the Tree.

More information

Absent: Lecture 3 Page 1. def foo(a, b): a = 5 b[0] = 99

Absent: Lecture 3 Page 1. def foo(a, b): a = 5 b[0] = 99 1. A function is a procedural abstract (a named body of code to perform some action and return a resulting value). The syntax of a function definition is: def functionname([parameter [, parameter]*]):

More information

Python, Part 2 CS 8: Introduction to Computer Science Lecture #4

Python, Part 2 CS 8: Introduction to Computer Science Lecture #4 Python, Part 2 CS 8: Introduction to Computer Science Lecture #4 Ziad Matni Dept. of Computer Science, UCSB A Word About Registration for CS8 This class is currently FULL The waitlist is CLOSED 4/13/17

More information

A Little Python Part 2

A Little Python Part 2 A Little Python Part 2 Introducing Programming with Python Data Structures, Program Control Outline Python and the System Data Structures Lists, Dictionaries Control Flow if, for, while Reminder - Learning

More information

Pymixup Documentation

Pymixup Documentation Pymixup Documentation Release 1.0.2 Richard DeVost June 09, 2016 Contents 1 Why Obfuscate? 3 2 What pymixup Does 5 3 Contents 7 3.1 Installation................................................ 7 3.2 Program

More information

pygtrie Release Jul 03, 2017

pygtrie Release Jul 03, 2017 pygtrie Release Jul 03, 2017 Contents 1 Features 3 2 Installation 5 3 Upgrading from 0.9.x 7 4 Trie classes 9 5 PrefixSet class 19 6 Version History 21 Python Module Index 23 i ii Implementation of a

More information

AI Programming CS S-02 Python

AI Programming CS S-02 Python AI Programming CS662-2013S-02 Python David Galles Department of Computer Science University of San Francisco 02-0: Python Name python comes from Monte Python s Flying Circus Most python references use

More information

Importing content from IMS packages created by other Course Management systems into LON CAPA.

Importing content from IMS packages created by other Course Management systems into LON CAPA. Importing content from IMS packages created by other Course Management systems into LON CAPA. 1. Import directly into a course (using DOCS > Import IMS package) suitable for course content (e.g., web pages,

More information

TREES AND ORDERS OF GROWTH 7

TREES AND ORDERS OF GROWTH 7 TREES AND ORDERS OF GROWTH 7 COMPUTER SCIENCE 61A October 17, 2013 1 Trees In computer science, trees are recursive data structures that are widely used in various settings. This is a diagram of a simple

More information

Code Autocomplete Manual

Code Autocomplete Manual Code Autocomplete Manual Release 2.0.0 Jacques Lucke July 02, 2016 Contents 1 Setup 3 1.1 Installation................................................ 3 1.2 Check the Installation..........................................

More information

simplevisor Documentation

simplevisor Documentation simplevisor Documentation Release 1.2 Massimo Paladin June 27, 2016 Contents 1 Main Features 1 2 Installation 3 3 Configuration 5 4 simplevisor command 9 5 simplevisor-control command 13 6 Supervisor

More information

CDK Documentation. Release v Simeon Franklin

CDK Documentation. Release v Simeon Franklin CDK Documentation Release v0.0.1 Simeon Franklin Sep 27, 2017 Contents 1 About 3 2 Installing 5 2.1 For users................................................. 5 2.2 For contributors.............................................

More information

CS 105 Perl: Modules and Objects

CS 105 Perl: Modules and Objects CS 105 Perl: Modules and Objects February 20, 2013 Agenda Today s lecture is an introduction to Perl modules and objects, but first we will cover a handy feature Perl has for making data structures. Where

More information

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

Programming Standards: You must conform to good programming/documentation standards. Some specifics: CS3114 (Spring 2011) PROGRAMMING ASSIGNMENT #3 Due Thursday, April 7 @ 11:00 PM for 100 points Early bonus date: Wednesday, April 6 @ 11:00 PM for a 10 point bonus Initial Schedule due Thursday, March

More information

Python I. Some material adapted from Upenn cmpe391 slides and other sources

Python I. Some material adapted from Upenn cmpe391 slides and other sources Python I Some material adapted from Upenn cmpe391 slides and other sources Overview Names & Assignment Data types Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics

More information

Python RPM Porting Guide Release 0.1

Python RPM Porting Guide Release 0.1 Python RPM Porting Guide Release 0.1 Red Hat, Inc. Apr 27, 2017 Contents 1 Porting the specfile to Python 3 2 2 Modifications 3 2.1 BuildRequires and Requires....................................... 3 2.2

More information

15-110: Principles of Computing, Spring 2018

15-110: Principles of Computing, Spring 2018 15-110: Principles of Computing, Spring 2018 Problem Set 5 (PS5) Due: Friday, February 23 by 2:30PM via Gradescope Hand-in HANDIN INSTRUCTIONS Download a copy of this PDF file. You have two ways to fill

More information

Functions CHAPTER 5. FIGURE 1. Concrete syntax for the P 2 subset of Python. (In addition to that of P 1.)

Functions CHAPTER 5. FIGURE 1. Concrete syntax for the P 2 subset of Python. (In addition to that of P 1.) CHAPTER 5 Functions The main ideas in this chapter are: first-class functions: functions are values that can be passed as arguments to other functions, returned from functions, stored in lists and dictionaries,

More information

Learning Goals. CS221: Algorithms and Data Structures Lecture #3 Mind Your Priority Queues. Today s Outline. Back to Queues. Priority Queue ADT

Learning Goals. CS221: Algorithms and Data Structures Lecture #3 Mind Your Priority Queues. Today s Outline. Back to Queues. Priority Queue ADT CS: Algorithms and Data Structures Lecture # Mind Your Priority Queues Steve Wolfman 0W Learning Goals Provide examples of appropriate applications for priority queues. Describe efficient implementations

More information

Web Services Week 3. Fall Emrullah SONUÇ. Department of Computer Engineering Karabuk University

Web Services Week 3. Fall Emrullah SONUÇ. Department of Computer Engineering Karabuk University Web Services Week 3 Emrullah SONUÇ Department of Computer Engineering Karabuk University Fall 2017 1 Recap XML, Writing XML Rules for Writing XML Elements, Attributes, and Values XSL, XSLT 2 Contents Homework

More information

Naked Documentation. Release Christopher Simpkins

Naked Documentation. Release Christopher Simpkins Naked Documentation Release 0.1.31 Christopher Simpkins Nov 04, 2017 Contents 1 A Python Command Line Application Framework 1 1.1 New Projects............................................... 1 1.2 Command

More information

JPdfBookmarks Manual. by Flaviano Petrocchi

JPdfBookmarks Manual. by Flaviano Petrocchi JPdfBookmarks Manual by Flaviano Petrocchi JPdfBookmarks Manual 1 Introduction 3 Installation and Uninstallation 4 Linux Instructions 4 Debian Instructions 6 Windows Instructions 6 Universal Archive Instructions

More information

Introduction to Python (All the Basic Stuff)

Introduction to Python (All the Basic Stuff) Introduction to Python (All the Basic Stuff) 1 Learning Objectives Python program development Command line, IDEs, file editing Language fundamentals Types & variables Expressions I/O Control flow Functions

More information

Alastair Burt Andreas Eisele Christian Federmann Torsten Marek Ulrich Schäfer. October 6th, Universität des Saarlandes. Introduction to Python

Alastair Burt Andreas Eisele Christian Federmann Torsten Marek Ulrich Schäfer. October 6th, Universität des Saarlandes. Introduction to Python Outline Alastair Burt Andreas Eisele Christian Federmann Torsten Marek Ulrich Schäfer Universität des Saarlandes October 6th, 2009 Outline Outline Today s Topics: 1 More Examples 2 Cool Stuff 3 Text Processing

More information

Programming to Python

Programming to Python Programming to Python Sept., 5 th Slides by M. Stepp, M. Goldstein, M. DiRamio, and S. Shah Compiling and interpreting Many languages require you to compile (translate) your program into a form that the

More information

Linux shell scripting Getting started *

Linux shell scripting Getting started * Linux shell scripting Getting started * David Morgan *based on chapter by the same name in Classic Shell Scripting by Robbins and Beebe What s s a script? text file containing commands executed as a unit

More information

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 CS 133 - Introduction to Computational and Data Science Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 Introduction to Python II In the previous class, you have

More information

Test/Debug Guide. Reference Pages. Test/Debug Guide. Site Map Index

Test/Debug Guide. Reference Pages. Test/Debug Guide. Site Map Index Site Map Index HomeInstallationStartAuthoringStreamSQLTest/DebugAPI GuideAdminAdaptersSamplesStudio GuideReferences Current Location: Home > Test/Debug Guide Test/Debug Guide The following topics explain

More information

A Crash Course in Python Part II. Presented by Cuauhtémoc Carbajal ITESM CEM

A Crash Course in Python Part II. Presented by Cuauhtémoc Carbajal ITESM CEM A Crash Course in Python Part II Presented by Cuauhtémoc Carbajal ITESM CEM 1 Importing and Modules 2 Importing and Modules Use classes & functions defined in another file A Python module is a file with

More information

unix intro Documentation

unix intro Documentation unix intro Documentation Release 1 Scott Wales February 21, 2013 CONTENTS 1 Logging On 2 1.1 Users & Groups............................................. 2 1.2 Getting Help...............................................

More information

Guido van Rossum 9th LASER summer school, Sept. 2012

Guido van Rossum 9th LASER summer school, Sept. 2012 Guido van Rossum guido@python.org 9th LASER summer school, Sept. 2012 Static analysis for Python is hard There are no good current tools There are a number of lint-like tools Some IDEs have some refactoring

More information

Final Exam Version A

Final Exam Version A CS112 Spring 2014 Dr. Kinga Dobolyi Final Exam Version A Do not open this exam until you are told. Read these instructions: 1. This is a closed book exam. No calculators, notes, or other aids are allowed.

More information

Language Design COMS W4115. Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science

Language Design COMS W4115. Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science Language Design COMS W4115 Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science Language Design Issues Syntax: how programs look Names and reserved words Instruction

More information

CS61A Notes Week 13: Interpreters

CS61A Notes Week 13: Interpreters CS61A Notes Week 13: Interpreters Read-Eval Loop Unlike Python, the result of evaluating an expression is not automatically printed. Instead, Logo complains if the value of any top-level expression is

More information

Assignment 7: functions and closure conversion (part 1)

Assignment 7: functions and closure conversion (part 1) Assignment 7: functions and closure conversion (part 1) ECEN 4553 & 5013, CSCI 4555 & 5525 Prof. Jeremy G. Siek November 12, 2008 The main ideas for this week are: first-class functions lexical scoping

More information

Range queries. Fenwick trees. Yaseen Mowzer. 2nd IOI Training Camp 2017 (4 February 2017)

Range queries. Fenwick trees. Yaseen Mowzer. 2nd IOI Training Camp 2017 (4 February 2017) Range queries Fenwick trees Yaseen Mowzer 2nd IOI Training Camp 2017 (4 February 2017) Preliminaries All ranges will be half open ranges e [a, b) a e < b Occasionally 1 is a more convenient starting index

More information

NOTES ON RUNNING PYTHON CODE

NOTES ON RUNNING PYTHON CODE NOTES ON RUNNING PYTHON CODE ERIC MARTIN Part 1. Setting things up The School has python 3.2.3 installed. 1. Installing python if necessary On personal computers with no version of python 3 installed,

More information

CS Fall 2010 B-trees Carola Wenk

CS Fall 2010 B-trees Carola Wenk CS 3343 -- Fall 2010 B-trees Carola Wenk 10/19/10 CS 3343 Analysis of Algorithms 1 External memory dictionary Task: Given a large amount of data that does not fit into main memory, process it into a dictionary

More information

Classloader J2EE rakendusserveris (Bea Weblogic Server, IBM WebSphere)

Classloader J2EE rakendusserveris (Bea Weblogic Server, IBM WebSphere) Tartu Ülikool Matemaatika-informaatika Teaduskond Referaat Classloader J2EE rakendusserveris (Bea Weblogic Server, IBM WebSphere) Autor: Madis Lunkov Inf II Juhendaja: Ivo Mägi Tartu 2005 Contents Contents...

More information

Teaching Python: The Hard Parts. Elana Hashman Rackspace PyCon 2016 Portland, OR

Teaching Python: The Hard Parts. Elana Hashman Rackspace PyCon 2016 Portland, OR Teaching Python: The Hard Parts Elana Hashman Rackspace PyCon 2016 Portland, OR Background Community Data Science Workshops Python Workshops for Beginners Total Beginners Platform Diversity Majority of

More information

Functions CHAPTER 5. FIGURE 1. Concrete syntax for the P 2 subset of Python. (In addition to that of P 1.)

Functions CHAPTER 5. FIGURE 1. Concrete syntax for the P 2 subset of Python. (In addition to that of P 1.) CHAPTER 5 Functions The main ideas in this chapter are: first-class functions: functions are values that can be passed as arguments to other functions, returned from functions, stored in lists and dictionaries,

More information

Nothing to see here...

Nothing to see here... Nothing to see here... Work in progress. Does not reflect reality, purely the thoughts of a mad man Deployment Models Single JVM Redundant JVM Externalized System Services Fully Distributed Or some other

More information

Intermediate Python 3.x

Intermediate Python 3.x Intermediate Python 3.x This 4 day course picks up where Introduction to Python 3 leaves off, covering some topics in more detail, and adding many new ones, with a focus on enterprise development. This

More information

Cross-platform daemonization tools.

Cross-platform daemonization tools. Cross-platform daemonization tools. Release 0.1.0 Muterra, Inc Sep 14, 2017 Contents 1 What is Daemoniker? 1 1.1 Installing................................................. 1 1.2 Example usage..............................................

More information

Less known packaging features and tricks

Less known packaging features and tricks Less known packaging features and tricks Who Ionel Cristian Mărieș ionel is read like yonel, @ionelmc, blog.ionelmc.ro Did PyPI releases of 40 something distinct packages, since 2007 Working on a project

More information

WebAD PeopleMinder v2.1 Installation and Configuration Guide

WebAD PeopleMinder v2.1 Installation and Configuration Guide WebAD PeopleMinder v2.1 Installation and Configuration Guide Instructions to Install and Configure PeopleMinder v2.1 Web Active Directory, LLC Contents Overview... 2 Installation Support... 2 System Requirements...

More information

XStatic Documentation

XStatic Documentation XStatic Documentation Release 1.0.1 Thomas Waldmann Sep 18, 2018 Contents 1 What is XStatic 1 1.1 The Idea................................................. 1 1.2 Pros....................................................

More information

1 of 5 5/11/2006 12:10 AM CS 61A Spring 2006 Midterm 2 solutions 1. Box and pointer. Note: Please draw actual boxes, as in the book and the lectures, not XX and X/ as in these ASCII-art solutions. Also,

More information

18.1 user guide No Magic, Inc. 2015

18.1 user guide No Magic, Inc. 2015 18.1 user guide No Magic, Inc. 2015 All material contained herein is considered proprietary information owned by No Magic, Inc. and is not to be shared, copied, or reproduced by any means. All information

More information

XML flex lessons from the trenches

XML flex lessons from the trenches XML flex lessons from the trenches HP ESP Global Services Eugenio Marrero, SA Tammy Torbert, SE Agenda Why XML flex connector? What documentation/tools are available? Basic XML concepts XML parser Installing

More information

Core Python is small by design

Core Python is small by design Core Python is small by design One of the key features of Python is that the actual core language is fairly small. This is an intentional design feature to maintain simplicity. Much of the powerful functionality

More information

CSE : Python Programming. Packages (Tutorial, Section 6.4) Announcements. Today. Packages: Concretely. Packages: Overview

CSE : Python Programming. Packages (Tutorial, Section 6.4) Announcements. Today. Packages: Concretely. Packages: Overview Announcements CSE 399-004: Python Programming Lecture 07: Packages, Command-line arguments, and Unit testing February 26, 2007 http://www.seas.upenn.edu/~cse39904/ No homework this week There may be one

More information

StreamServe Persuasion SP5 XMLIN

StreamServe Persuasion SP5 XMLIN StreamServe Persuasion SP5 XMLIN User Guide Rev A StreamServe Persuasion SP5 XMLIN User Guide Rev A 2001-2010 STREAMSERVE, INC. ALL RIGHTS RESERVED United States patent #7,127,520 No part of this document

More information

django-dynamic-db-router Documentation

django-dynamic-db-router Documentation django-dynamic-db-router Documentation Release 0.1.1 Erik Swanson August 24, 2016 Contents 1 Table of Contents 3 1.1 Installation................................................ 3 1.2 Quickstart................................................

More information

Manual Script Windows Batch For Loop Files In A Directory

Manual Script Windows Batch For Loop Files In A Directory Manual Script Windows Batch For Loop Files In A Directory If I run the batch file manually from the command prompt, it works fine. think it is (it refers to the current directory, which is not necessarily

More information

1 <?xml encoding="utf-8"?> 1 2 <bubbles> 2 3 <!-- Dilbert looks stunned --> 3

1 <?xml encoding=utf-8?> 1 2 <bubbles> 2 3 <!-- Dilbert looks stunned --> 3 4 SAX SAX Simple API for XML 4 SAX Sketch of SAX s mode of operations SAX 7 (Simple API for XML) is, unlike DOM, not a W3C standard, but has been developed jointly by members of the XML-DEV mailing list

More information

Basic Python 3 Programming (Theory & Practical)

Basic Python 3 Programming (Theory & Practical) Basic Python 3 Programming (Theory & Practical) Length Delivery Method : 5 Days : Instructor-led (Classroom) Course Overview This Python 3 Programming training leads the student from the basics of writing

More information

Lecture 23. Java File Handling. Dr. Martin O Connor CA166

Lecture 23. Java File Handling. Dr. Martin O Connor CA166 Lecture 23 Java File Handling Dr. Martin O Connor CA166 www.computing.dcu.ie/~moconnor Topics File Systems What is a path? Symbolic links How to create a file How to obtain the file path from a file How

More information

Download Python from Any version will do for this class

Download Python from  Any version will do for this class Let s Start Python Let s Start! Download Python from www.python.org Any version will do for this class By and large they are all mutually compatible Recommended version: 2.1.1 or 2.2 Oldest version still

More information