CSE : Python Programming

Size: px
Start display at page:

Download "CSE : Python Programming"

Transcription

1 CSE : Python Programming Lecture 08: Graphical User Interfaces with wxpython March 12,

2 Plan for today and next time Today: wxpython (part 1) Aside: Arguments to functions Whirlwind tour of the widgets Next time: wxpython (part 2) XRCed (?) Event handling me by Friday with ideas for something I can build during lecture 2

3 Arguments to functions (Tutorial 4.7)

4 Default arguments (Part 1) >>> i = 10 >>> def f(arg = i): print arg >>> i = 20 >>> f() 10 >>> f(15) 15 If no value is supplied for arg, use i. The value of the default argument is evaluated at the point when the function is defined. 4

5 Default arguments (Part 2) >>> def f(elt, arg = []): arg.append(elt) return arg >>> f(1) [1] >>> f(2) [1, 2] >>> f(3) [1, 2, 3] Arguments with default values must come at the end of the arguments list. If a default value is mutable, its value persists across calls. 5

6 Keyword arguments (Part 1) >>> def f(foo, bar, baz = 'baz'): print foo, bar, baz >>> f(bar = 2, foo = 3) 3 2 baz >>> f(foo = 1, bar = 2) 1 2 baz >>> f(1, bar = 3) 1 3 baz We can give the values for a functions arguments by name. We can mix positional arguments with keyword arguments, but keyword arguments must come last. 6

7 Keyword arguments (Part 2) >>> def f(foo, bar = 'bar', baz = 'baz'): print foo, bar, baz >>> f(1) 1 bar baz >>> f(2, baz = 3) 2 bar 3 Using keyword arguments lets us give values to arguments which have default values. 7

8 General rules for calling functions Positional arguments come before keyword arguments The value of each argument must be given at most once >>> def f(a = 2): print a >>> f() 2 >>> f(10) 10 >>> f(a = 20) 20 8

9 General rules for calling functions Positional arguments come before keyword arguments The value of each argument must be given at most once >>> def f(a = 2): print a >>> f(a = 30, 0) File "<stdin>", line 1 SyntaxError: non-keyword arg after keyword arg 9

10 General rules for calling functions Positional arguments come before keyword arguments The value of each argument must be given at most once >>> def f(a = 2): print a >>> f(0, a = 30) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: f() got multiple values for keyword argument ' 10

11 Arbitrary argument lists >>> def f(arg, bar = 3, *rest, **keywords): print arg, bar, rest, keywords >>> f(1) 1 3 () {} >>> f(1, 2) 1 2 () {} >>> f(1, 2, 3, 4) 1 2 (3, 4) {} >>> f(1, a = 2, b = 3) 1 3 () {'a': 2, 'b': 3} >>> f(1, 2, 3, 4, a = 5, b = 6) 1 2 (3, 4) {'a': 5, 'b': 6} f has one required argument f has two positional arguments 11

12 Arbitrary argument lists >>> def f(arg, bar = 3, *rest, **keywords): print arg, bar, rest, keywords >>> f(1) 1 3 () {} Extra positional arguments are put >>> f(1, 2) in a tuple and passed in as rest. 1 2 () {} >>> f(1, 2, 3, 4) 1 2 (3, 4) {} >>> f(1, a = 2, b = 3) 1 3 () {'a': 2, 'b': 3} >>> f(1, 2, 3, 4, a = 5, b = 6) 1 2 (3, 4) {'a': 5, 'b': 6} 12

13 Arbitrary argument lists >>> def f(arg, bar = 3, *rest, **keywords): print arg, bar, rest, keywords >>> f(1) 1 3 () {} >>> f(1, 2) 1 2 () {} >>> f(1, 2, 3, 4) 1 2 (3, 4) {} >>> f(1, a = 2, b = 3) 1 3 () {'a': 2, 'b': 3} >>> f(1, 2, 3, 4, a = 5, b = 6) 1 2 (3, 4) {'a': 5, 'b': 6} Extra keyword arguments are put in a dictionary and passed in as keywords. 13

14 Arbitrary argument lists >>> def f(arg, bar = 3, *rest, **keywords): print arg, bar, rest, keywords >>> f(1) 1 3 () {} >>> f(1, 2) 1 2 () {} >>> f(1, 2, 3, 4) 1 2 (3, 4) {} >>> f(1, a = 2, b = 3) 1 3 () {'a': 2, 'b': 3} >>> f(1, 2, 3, 4, a = 5, b = 6) 1 2 (3, 4) {'a': 5, 'b': 6} 14

15 wxpython

16 wxpython A set of bindings to the cross-platform wxwidgets GUI library (written in C++) Claim: Makes it easy to develop graphical user interfaces (GUIs) for applications in Python 16

17 Tkinter vs. wxpython Tkinter and wxpython are both GUI libraries for Python Tkinter: Comes with the standard Python distribution Non-native look and feel Cumbersome to build complex UIs "Stale" wxpython: Not part of standard Python distribution Native look and feel Easier to work with than Tkinter "Up and coming" 17

18 Resources Online API documentation: Wiki: The demo application that comes with wxpython Has demos of all the widgets Includes the source code for the demos 18

19 Resources Tutorial: Tutorial: The second is a bit better (in my opinion) Neither does that great a job explaining event handling My suggestion: Work by example 19

20 Event handling GUIs are event driven: They sit around doing nothing until the user clicks a button, moves the mouse, etc. You, the programmer, are responsible for indicating how events are to be handled You are not responsible for polling for events The style of programming here is quite different from normal sequential programming 20

21 Some terminology A window is anything that consumes screen space A frame is what you normally think of as a "window" 21

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

61A Lecture 2. Friday, August 28, 2015

61A Lecture 2. Friday, August 28, 2015 61A Lecture 2 Friday, August 28, 2015 Names, Assignment, and User-Defined Functions (Demo) Types of Expressions Primitive expressions: 2 add 'hello' Number or Numeral Name String Call expressions: max

More information

CSE : Python Programming

CSE : Python Programming CSE 399-004: Python Programming Lecture 10: Functional programming, Memoization March 26, 2007 http://www.seas.upenn.edu/~cse39904/ Announcements Should have received email about meeting times Length:

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

Lecture 4. Defining Functions

Lecture 4. Defining Functions Lecture 4 Defining Functions Academic Integrity Quiz Reading quiz about the course AI policy Go to http://www.cs.cornell.edu/courses/cs11110/ Click Academic Integrity in side bar Read and take quiz in

More information

Lecture 3. Functions & Modules

Lecture 3. Functions & Modules Lecture 3 Functions & Modules Labs this Week Lab 1 is due at the beginning of your lab If it is not yet by then, you cannot get credit Only exception is for students who added late (Those students should

More information

Announcements. Lecture Agenda. Class Exercise. Hashable. Mutability. COMP10001 Foundations of Computing Iteration

Announcements. Lecture Agenda. Class Exercise. Hashable. Mutability. COMP10001 Foundations of Computing Iteration COMP10001 Foundations of Computing Iteration Announcements Semester 1, 2017 Tim Baldwin & Egemen Tanin First Guest Lecture on Friday (examinable) Grok Worksheets 5 7 due at the end of this week version:

More information

Today: Revisit some objects. Programming Languages. Key data structure: Dictionaries. Using Dictionaries. CSE 130 : Winter 2009

Today: Revisit some objects. Programming Languages. Key data structure: Dictionaries. Using Dictionaries. CSE 130 : Winter 2009 CSE 130 : Winter 2009 Programming Languages Lecture 11: What s in a Name? Today: Revisit some objects Exploit features and build powerful expressions Base: int, float, complex Sequence: string, tuple,

More information

LECTURE 2. Python Basics

LECTURE 2. Python Basics LECTURE 2 Python Basics MODULES ''' Module fib.py ''' from future import print_function def even_fib(n): total = 0 f1, f2 = 1, 2 while f1 < n: if f1 % 2 == 0: total = total + f1 f1, f2 = f2, f1 + f2 return

More information

Lecture 3. Functions & Modules

Lecture 3. Functions & Modules Lecture 3 Functions & Modules Labs this Week Lab 1 is due at the beginning of your lab If it is not yet by then, you cannot get credit Only exception is for students who added late (Those students should

More information

Programming Languages

Programming Languages CSE 130 : Fall 2009 Programming Languages Lecture 13: Whats in a name? Ranjit Jhala UC San Diego f = open( foo.txt, read ) f.readlines() for l in f.readlines(): f.close ou now know enough to do PA5

More information

Not-So-Mini-Lecture 6. Modules & Scripts

Not-So-Mini-Lecture 6. Modules & Scripts Not-So-Mini-Lecture 6 Modules & Scripts Interactive Shell vs. Modules Launch in command line Type each line separately Python executes as you type Write in a code editor We use Atom Editor But anything

More information

Python GUI programming with PySide. Speaker: BigLittle Date: 2013/03/04

Python GUI programming with PySide. Speaker: BigLittle Date: 2013/03/04 Python GUI programming with PySide Speaker: BigLittle Date: 2013/03/04 CLI vs. GUI CLI (Command Line Interface) Take less resources. User have much more control of their system. Only need to execute few

More information

Friday, 11 April 14. Advanced methods for creating decorators Graham Dumpleton PyCon US - April 2014

Friday, 11 April 14. Advanced methods for creating decorators Graham Dumpleton PyCon US - April 2014 Advanced methods for creating decorators Graham Dumpleton PyCon US - April 2014 Intermission Rant about the history of this talk and why this topic matters. Python decorator syntax @function_wrapper def

More information

CS1 Lecture 13 Feb. 13, 2019

CS1 Lecture 13 Feb. 13, 2019 CS1 Lecture 13 Feb. 13, 2019 Exam 1, Thursday evening, 2/21, 6:30-8:00pm, W290 CB Email about make-ups will be sent tomorrow HW4 Q1 available. Q2 Q4 tomorrow. For Q1 only, Academic Honesty policy does

More information

Outline. Simple types in Python Collections Processing collections Strings Tips. 1 On Python language. 2 How to use Python. 3 Syntax of Python

Outline. Simple types in Python Collections Processing collections Strings Tips. 1 On Python language. 2 How to use Python. 3 Syntax of Python Outline 1 On Python language 2 3 4 Marcin Młotkowski Object oriented programming 1 / 52 On Python language The beginnings of Pythons 90 CWI Amsterdam, Guido van Rossum Marcin Młotkowski Object oriented

More information

Programming Languages

Programming Languages CSE 130 : Spring 2011 Programming Languages Lecture 13: What s in a Name? Ranjit Jhala UC San Diego Next: What s in a name? More precisely: How should programmer think of data What does a variable x really

More information

Next: What s in a name? Programming Languages. Data model in functional PL. What s in a name? CSE 130 : Fall Lecture 13: What s in a Name?

Next: What s in a name? Programming Languages. Data model in functional PL. What s in a name? CSE 130 : Fall Lecture 13: What s in a Name? Next: What s in a name? CSE 13 : Fall 211 Programming Languages Lecture 13: What s in a Name? More precisely: How should programmer think of data What does a variable x really mean? Ranjit Jhala UC San

More information

Overview of List Syntax

Overview of List Syntax Lists and Sequences Overview of List Syntax x = [0, 0, 0, 0] Create list of length 4 with all zeroes x 4300112 x.append(2) 3 in x x[2] = 5 x[0] = 4 k = 3 Append 2 to end of list x (now length 5) Evaluates

More information

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department 0901212 Python Programming 1 st Semester 2014/2015 Course Catalog This course introduces

More information

Introduction to Python

Introduction to Python Introduction to Python EECS 4415 Big Data Systems Tilemachos Pechlivanoglou tipech@eecs.yorku.ca 2 Background Why Python? "Scripting language" Very easy to learn Interactive front-end for C/C++ code Object-oriented

More information

CSE : Python Programming. Decorators. Announcements. The decorator pattern. The decorator pattern. The decorator pattern

CSE : Python Programming. Decorators. Announcements. The decorator pattern. The decorator pattern. The decorator pattern CSE 399-004: Python Programming Lecture 12: Decorators April 9, 200 http://www.seas.upenn.edu/~cse39904/ Announcements Projects (code and documentation) are due: April 20, 200 at pm There will be informal

More information

Sequences and iteration in Python

Sequences and iteration in Python GC3: Grid Computing Competence Center Sequences and iteration in Python GC3: Grid Computing Competence Center, University of Zurich Sep. 11 12, 2013 Sequences Python provides a few built-in sequence classes:

More information

Python for Non-programmers

Python for Non-programmers Python for Non-programmers A Gentle Introduction 1 Yann Tambouret Scientific Computing and Visualization Information Services & Technology Boston University 111 Cummington St. yannpaul@bu.edu Winter 2013

More information

Lecture 9: July 14, How to Think About Debugging

Lecture 9: July 14, How to Think About Debugging Lecture 9: July 14, 2011 How to Think About Debugging So, you wrote your program. And, guess what? It doesn t work. L Your program has a bug in it Somehow, you must track down the bug and fix it Need to

More information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming User Interfaces (Graphical and Text) Eric Kutschera University of Pennsylvania March 20, 2015 Eric Kutschera (University of Pennsylvania) CIS 192 March 20, 2015 1 / 23 Final Project

More information

Working with Lists 4

Working with Lists 4 CS 61A Lecture 10 Announcements Lists ['Demo'] Working with Lists 4 Working with Lists >>> digits = [1, 8, 2, 8] 4 Working with Lists >>> digits = [1, 8, 2, 8] >>> digits = [2//2, 2+2+2+2, 2, 2*2*2] 4

More information

CSC108: Introduction to Computer Programming. Lecture 11

CSC108: Introduction to Computer Programming. Lecture 11 CSC108: Introduction to Computer Programming Lecture 11 Wael Aboulsaadat Acknowledgment: these slides are based on material by: Velian Pandeliev, Diane Horton, Michael Samozi, Jennifer Campbell, and Paul

More information

Course Outline - COMP150. Lectures and Labs

Course Outline - COMP150. Lectures and Labs Course Outline - COMP150 Lectures and Labs 1 The way of the program 1.1 The Python programming language 1.2 What is a program? 1.3 What is debugging? 1.4 Experimental debugging 1.5 Formal and natural languages

More information

Introduction to Programming in Python (2)

Introduction to Programming in Python (2) Introduction to Programming in Python (2) Steve Renals s.renals@ed.ac.uk ICL 29 September 2005 Conditionals Loops Function basics Variables and functions Functional programming Designing functions Python

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

Online Free Ebooks Download Tkinter GUI Application Development Blueprints

Online Free Ebooks Download Tkinter GUI Application Development Blueprints Online Free Ebooks Download Tkinter GUI Application Development Blueprints Master GUI programming in Tkinter as you design, implement, and deliver ten real-world applications from start to finishabout

More information

logstack Documentation

logstack Documentation logstack Documentation Release 0.1 Remi Rampin Apr 08, 2017 Contents 1 Getting started 1 2 Contents 3 2.1 Reference................................................. 3 2.2 Internal reference.............................................

More information

CS123. Programming Your Personal Robot. Part 2: Event Driven Behavior

CS123. Programming Your Personal Robot. Part 2: Event Driven Behavior CS123 Programming Your Personal Robot Part 2: Event Driven Behavior You Survived! Smooth Sailing Topics 2.1 Event Driven Programming Programming Paradigms and Paradigm Shift Event Driven Programming Concept

More information

HIGHER ORDER FUNCTIONS 2

HIGHER ORDER FUNCTIONS 2 HIGHER ORDER FUNCTIONS 2 COMPUTER SCIENCE 61A June 21, 2012 1. You already saw in lecture a method to check if a number is prime: def is_prime(n): k = 2 while k < n: if n % k == 0: return False k += 1

More information

ENVIRONMENT MODEL: FUNCTIONS, DATA 18

ENVIRONMENT MODEL: FUNCTIONS, DATA 18 ENVIRONMENT MODEL: FUNCTIONS, DATA 18 COMPUTER SCIENCE 61A Jon Kotker and Tom Magrino July 18, 2012 1 Motivation Yesterday, we introduced the environment model of computation as an alternative to the earlier

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

Iterators & Generators

Iterators & Generators Iterators & Generators Sequences A sequence is something that you can: Index into Get the length of What are some examples of sequences? Sequences We ve been working with sequences all semester! Examples:

More information

Python 1: Intro! Max Dougherty Andrew Schmitt

Python 1: Intro! Max Dougherty Andrew Schmitt Python 1: Intro! Max Dougherty Andrew Schmitt Computational Thinking Two factors of programming: The conceptual solution to a problem. Solution syntax in a programming language BJC tries to isolate and

More information

Homework notes. Homework 2 grades posted on canvas. Homework 3 due tomorrow. Homework 4 posted on canvas. Due Tuesday, Oct. 3

Homework notes. Homework 2 grades posted on canvas. Homework 3 due tomorrow. Homework 4 posted on canvas. Due Tuesday, Oct. 3 References Homework notes Homework 2 grades posted on canvas Homework 3 due tomorrow Homework 4 posted on canvas Due Tuesday, Oct. 3 Style notes Comment your code! A short line of comments per logical

More information

dypy: Dynamical Systems in Python PHY250 Project Report Spring 2008

dypy: Dynamical Systems in Python PHY250 Project Report Spring 2008 dypy: Dynamical Systems in Python PHY250 Project Report Spring 2008 SOPHIE ENGLE AND SEAN WHALEN Department of Computer Science {sjengle,shwhalen}@ucdavis.edu Abstract: This project introduces dypy an

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

Widget Toolkits CS MVC

Widget Toolkits CS MVC Widget Toolkits 1 CS349 -- MVC Widget toolkits Also called widget libraries or GUI toolkits or GUI APIs Software bundled with a window manager, operating system, development language, hardware platform

More information

[301] Objects/References. Tyler Caraza-Harter

[301] Objects/References. Tyler Caraza-Harter [301] Objects/References Tyler Caraza-Harter Learning Objectives Today More data types tuple (immutable list) custom types: creating objects from namedtuple and recordclass References Motivation is vs

More information

Worksheet 6: Basic Methods Methods The Format Method Formatting Floats Formatting Different Types Formatting Keywords

Worksheet 6: Basic Methods Methods The Format Method Formatting Floats Formatting Different Types Formatting Keywords Worksheet 1: Introductory Exercises Turtle Programming Calculations The Print Function Comments Syntax Semantics Strings Concatenation Quotation Marks Types Variables Restrictions on Variable Names Long

More information

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 FALL 2017 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 CMS VideoNote.com, PPT slides, DrJava 2 CMS. Visit course webpage, click Links, then CMS for 2110.

More information

Portable GUI for ptpython shell

Portable GUI for ptpython shell IT Carlow Bachelor of Software Development Year 4 Portable GUI for ptpython shell Student Name: Inga Melkerte Student ID: C00184799 Supervisor: Paul Barry Date: 31/10/16 Table of Contents Table of Contents

More information

Lecture 9: GUI and debugging

Lecture 9: GUI and debugging Lecture 9: GUI and debugging Introduction for Linguists (LT2102) Markus Forsberg Språkbanken University of Gothenburg October 12, 2010 Assignment 2 I have now corrected all assignments. If you have not

More information

mpl Release latest May 17, 2017

mpl Release latest May 17, 2017 mpl a nimationmanagerdocumentation Release latest May 17, 2017 Contents 1 NOTE: Documentation is curently in development!!! 1 1.1 Matplotlib animation manager (GUI) 1.0a1...............................

More information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming Graphical User Interfaces Robert Rand University of Pennsylvania November 19, 2015 Robert Rand (University of Pennsylvania) CIS 192 November 19, 2015 1 / 20 Outline 1 Graphical

More information

MUTABLE LISTS AND DICTIONARIES 4

MUTABLE LISTS AND DICTIONARIES 4 MUTABLE LISTS AND DICTIONARIES 4 COMPUTER SCIENCE 61A Sept. 24, 2012 1 Lists Lists are similar to tuples: the order of the data matters, their indices start at 0. The big difference is that lists are mutable

More information

COMP519 Web Programming Lecture 20: Python (Part 4) Handouts

COMP519 Web Programming Lecture 20: Python (Part 4) Handouts COMP519 Web Programming Lecture 20: Python (Part 4) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents

More information

Functions, Scope & Arguments. HORT Lecture 12 Instructor: Kranthi Varala

Functions, Scope & Arguments. HORT Lecture 12 Instructor: Kranthi Varala Functions, Scope & Arguments HORT 59000 Lecture 12 Instructor: Kranthi Varala Functions Functions are logical groupings of statements to achieve a task. For example, a function to calculate the average

More information

LECTURE 17. GUI Programming

LECTURE 17. GUI Programming LECTURE 17 GUI Programming GUI PROGRAMMING IN PYTHON There are a number of platform-independent GUI toolkits available including: Tkinter wrapper around Tcl/Tk. PyQt Python bindings for the Qt C++ framework.

More information

1 Lecture 7: Functions I

1 Lecture 7: Functions I L7 June 18, 2017 1 Lecture 7: Functions I CSCI 1360E: Foundations for Informatics and Analytics 1.1 Overview and Objectives In this lecture, we ll introduce the concept of functions, critical abstractions

More information

CSE 140 wrapup. Michael Ernst CSE 140 University of Washington

CSE 140 wrapup. Michael Ernst CSE 140 University of Washington CSE 140 wrapup Michael Ernst CSE 140 University of Washington Progress in 10 weeks 10 weeks ago: you knew no programming Goals: Computational problem-solving Python programming language Experience with

More information

Introduction To Python Programming And Developing GUI Applications With PyQT By B. M. Harwani

Introduction To Python Programming And Developing GUI Applications With PyQT By B. M. Harwani Introduction To Python Programming And Developing GUI Applications With PyQT By B. M. Harwani Share And Download IT Ebook. Find By Tags: gui - "Introduction to Python Programming and Developing GUI Applications

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

Argparse Tutorial Release 2.7.9

Argparse Tutorial Release 2.7.9 Argparse Tutorial Release 2.7.9 Guido van Rossum and the Python development team December 10, 2014 Python Software Foundation Email: docs@python.org Contents 1 Concepts 1 2 The basics 2 3 Introducing Positional

More information

ERTH 401 / GEOP 501 Computational Methods for Geoscientists. Lecture 04: Functions

ERTH 401 / GEOP 501 Computational Methods for Geoscientists. Lecture 04: Functions ERTH 401 / GEOP 501 Computational Methods for Geoscientists Lecture 04: Functions Ronni Grapenthin rg@nmt.edu MSEC 356 x5924 September 18, 2017 1 / 15 2 / 15 Wouldn t it be great if we could think up some

More information

CME 193: Introduction to Scientific Python Lecture 1: Introduction

CME 193: Introduction to Scientific Python Lecture 1: Introduction CME 193: Introduction to Scientific Python Lecture 1: Introduction Nolan Skochdopole stanford.edu/class/cme193 1: Introduction 1-1 Contents Administration Introduction Basics Variables Control statements

More information

CSE 341: Programming Languages

CSE 341: Programming Languages CSE 341: Programming Languages Hal Perkins Spring 2011 Lecture 2 Functions, pairs, and lists Hal Perkins CSE341 Spring 2011, Lecture 2 1 What is a programming language? Here are separable concepts for

More information

CSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion

CSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion CSC 148 Lecture 3 Dynamic Typing, Scoping, and Namespaces Recursion Announcements Python Ramp Up Session Monday June 1st, 1 5pm. BA3195 This will be a more detailed introduction to the Python language

More information

Lecture 7. Memory in Python

Lecture 7. Memory in Python Lecture 7 Memory in Python Announcements For This Lecture Readings Reread Chapter 3 No reading for Thursday Lab Work on Assignment Credit when submit A Nothing else to do Assignment Moved to Fri, Sep.

More information

CSC326 Meta Programming i. CSC326 Meta Programming

CSC326 Meta Programming i. CSC326 Meta Programming i CSC326 Meta Programming ii REVISION HISTORY NUMBER DATE DESCRIPTION NAME 1.0 2011-09 JZ iii Contents 1 Agenda 1 2 Class Factory 1 3 Meta Class 1 4 Decorator 2 5 Misuse of Decorators 3 6 Using Decorators

More information

CS 11 python track: lecture 4

CS 11 python track: lecture 4 CS 11 python track: lecture 4 Today: More odds and ends assertions "print >>" syntax more on argument lists functional programming tools list comprehensions More on exception handling More on object-oriented

More information

CSE : Python Programming. Homework 5 and Projects. Announcements. Course project: Overview. Course Project: Grading criteria

CSE : Python Programming. Homework 5 and Projects. Announcements. Course project: Overview. Course Project: Grading criteria CSE 399-004: Python Programming Lecture 5: Course project and Exceptions February 12, 2007 Announcements Still working on grading Homeworks 3 and 4 (and 2 ) Homework 5 will be out by tomorrow morning I

More information

Asynchronous Programming

Asynchronous Programming Asynchronous Programming Turn-in Instructions A main file, called gui.py See previous slides for how to make it main I ll run it from the command line Put in a ZIP file, along with any additional needed

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

Exceptions & a Taste of Declarative Programming in SQL

Exceptions & a Taste of Declarative Programming in SQL Exceptions & a Taste of Declarative Programming in SQL David E. Culler CS8 Computational Structures in Data Science http://inst.eecs.berkeley.edu/~cs88 Lecture 12 April 18, 2016 Computational Concepts

More information

Lecture 4. Defining Functions

Lecture 4. Defining Functions Lecture 4 Defining Functions Academic Integrity Quiz Remember: quiz about the course AI policy Have posted grades for completed quizes Right now, missing ~130 enrolled students If did not receive at least

More information

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this

More information

Notebook. March 30, 2019

Notebook. March 30, 2019 Notebook March 30, 2019 1 Complex Data Types Some kinds of data can store other kinds of data. 1.1 Lists We ve actually seen the most common complex data type a few times before, I just haven t pointed

More information

Python. Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar. December 28, Outline

Python. Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar. December 28, Outline Python Jae-Gil Lee Based on the slides by K. Naik, M. Raju, and S. Bhatkar December 28, 2011 1 Outline Introduction Installation and Use Distinct Features Python Basics Functional Example Comparisons with

More information

THE PRAGMATIC INTRO TO REACT. Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX

THE PRAGMATIC INTRO TO REACT. Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX THE PRAGMATIC INTRO TO REACT Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX REACT "A JavaScript library for building user interfaces" But first... HOW WE GOT HERE OR: A BRIEF

More information

Embedding Python in Your C Programs

Embedding Python in Your C Programs 1 of 7 6/18/2006 9:05 PM Embedding Python in Your C Programs William Nagel Abstract C, meet Python. Python, this is C. With surprisingly little effort, the Python interpreter can be integrated into your

More information

CIS192: Python Programming

CIS192: Python Programming CIS192: Python Programming Functions and Functional Programming Harry Smith University of Pennsylvania January 25, 2018 Harry Smith (University of Pennsylvania) CIS 192 Lecture 3 January 25, 2018 1 / 39

More information

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia) 15-251 Great Ideas in Theoretical Computer Science Lecture 12: Graphs I: The Basics February 22nd, 2018 Crossing bridges Königsberg (Prussia) Now Kaliningrad (Russia) Is there a way to walk through the

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013 University of Washington CSE 140 Introduction to Data Programming Winter 2013 Midterm exam February 6, 2013 Name: Solutions UW Net ID (username): This exam is closed book, closed notes. You have 50 minutes

More information

GUI in C++ PV264 Advanced Programming in C++ Nikola Beneš Jan Mrázek Vladimír Štill. Faculty of Informatics, Masaryk University.

GUI in C++ PV264 Advanced Programming in C++ Nikola Beneš Jan Mrázek Vladimír Štill. Faculty of Informatics, Masaryk University. GUI in C++ PV264 Advanced Programming in C++ Nikola Beneš Jan Mrázek Vladimír Štill Faculty of Informatics, Masaryk University Spring 2017 PV264: GUI in C++ Spring 2017 1 / 23 Organisation Lectures this

More information

Lecture 3 - Overview. More about functions Operators Very briefly about naming conventions Graphical user interfaces (GUIs)

Lecture 3 - Overview. More about functions Operators Very briefly about naming conventions Graphical user interfaces (GUIs) Lecture 3 - Overview More about functions Operators Very briefly about naming conventions Graphical user interfaces (GUIs) Function parameters Passed by reference, but the standard implication that the

More information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming Object Oriented Programming Harry Smith University of Pennsylvania February 15, 2016 Harry Smith (University of Pennsylvania) CIS 192 Lecture 5 February 15, 2016 1 / 26 Outline

More information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming Functional Programming Eric Kutschera University of Pennsylvania January 30, 2015 Eric Kutschera (University of Pennsylvania) CIS 192 January 30, 2015 1 / 31 Questions Homework

More information

CSE341: Programming Languages Lecture 11 Type Inference. Dan Grossman Spring 2016

CSE341: Programming Languages Lecture 11 Type Inference. Dan Grossman Spring 2016 CSE341: Programming Languages Lecture 11 Type Inference Dan Grossman Spring 2016 Type-checking (Static) type-checking can reject a program before it runs to prevent the possibility of some errors A feature

More information

Discussion CSE 224. Week 4

Discussion CSE 224. Week 4 Discussion CSE 224 Week 4 Midterm The midterm will cover - 1. Topics discussed in lecture 2. Research papers from the homeworks 3. Textbook readings from Unit 1 and Unit 2 HW 3&4 Clarifications 1. The

More information

STATS Data Analysis using Python. Lecture 8: Hadoop and the mrjob package Some slides adapted from C. Budak

STATS Data Analysis using Python. Lecture 8: Hadoop and the mrjob package Some slides adapted from C. Budak STATS 700-002 Data Analysis using Python Lecture 8: Hadoop and the mrjob package Some slides adapted from C. Budak Recap Previous lecture: Hadoop/MapReduce framework in general Today s lecture: actually

More information

Read & Download (PDF Kindle) Programming Python

Read & Download (PDF Kindle) Programming Python Read & Download (PDF Kindle) Programming Python If you've mastered Python's fundamentals, you're ready to start using it to get real work done. Programming Python will show you how, with in-depth tutorials

More information

Asynchronous I/O: A Case Study in Python

Asynchronous I/O: A Case Study in Python Asynchronous I/O: A Case Study in Python SALEIL BHAT A library for performing await -style asynchronous socket I/O was written in Python. It provides an event loop, as well as a set of asynchronous functions

More information

1 of 5 3/28/2010 8:01 AM Unit Testing Notes Home Class Info Links Lectures Newsgroup Assignmen [Jump to Writing Clear Tests, What about Private Functions?] Testing The typical approach to testing code

More information

Today. CISC101 Reminders & Notes. Searching in Python - Cont. Searching in Python. From last time

Today. CISC101 Reminders & Notes. Searching in Python - Cont. Searching in Python. From last time CISC101 Reminders & Notes Test 3 this week in tutorial USATs at the beginning of next lecture Please attend and fill out an evaluation School of Computing First Year Information Session Thursday, March

More information

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008

More information

PYTHON GUI PROGRAMMING COOKBOOK BY BURKHARD A. MEIER DOWNLOAD EBOOK : PYTHON GUI PROGRAMMING COOKBOOK BY BURKHARD A. MEIER PDF

PYTHON GUI PROGRAMMING COOKBOOK BY BURKHARD A. MEIER DOWNLOAD EBOOK : PYTHON GUI PROGRAMMING COOKBOOK BY BURKHARD A. MEIER PDF Read Online and Download Ebook PYTHON GUI PROGRAMMING COOKBOOK BY BURKHARD A. MEIER DOWNLOAD EBOOK : PYTHON GUI PROGRAMMING COOKBOOK BY BURKHARD A. MEIER PDF Click link bellow and free register to download

More information

Welcome to CS50 section! This is Week 10 :(

Welcome to CS50 section! This is Week 10 :( Welcome to CS50 section! This is Week 10 :( This is our last section! Final project dates Official proposals: due this Friday at noon Status report: due Monday, Nov 28 at noon Hackathon: Thursday, Dec

More information

Easy Graphical User Interfaces

Easy Graphical User Interfaces Easy Graphical User Interfaces with breezypythongui Types of User Interfaces GUI (graphical user interface) TUI (terminal-based user interface) UI Inputs Outputs Computation Terminal-Based User Interface

More information

Mid Unit Review. Of the four learning outcomes for this unit, we have covered the first two. 1.1 LO1 2.1 LO2 LO2

Mid Unit Review. Of the four learning outcomes for this unit, we have covered the first two. 1.1 LO1 2.1 LO2 LO2 Lecture 8 Mid Unit Review Of the four learning outcomes for this unit, we have covered the first two. LO Learning outcome (LO) AC Assessment criteria for pass The learner can: LO1 Understand the principles

More information

CS 4300 Computer Graphics

CS 4300 Computer Graphics CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture 8 September 22, 2011 GUIs GUIs in modern operating systems cross-platform GUI frameworks common GUI widgets event-driven programming Model-View-Controller

More information

What Would Python Print? Tuples, Lists, Dictionaries

What Would Python Print? Tuples, Lists, Dictionaries Review Questions What Would Python Print? Tuples, Lists, Dictionaries >>> a = (1, 2, 3, 4) >>> a[::-1] >>> a = a[:0:-1] >>> a >>> b = [1, 2, 3, 4] >>> b[3] = a[1:] >>> b >>> b[3][0] = a[:-2] What Would

More information

Lecture 1: Introduction to Python

Lecture 1: Introduction to Python Hendrik Weimer Institute for Theoretical Physics, Leibniz University Hannover Quantum Physics with Python, 04 April 2016 Goals of this course Learn to use the Python language for physics problems Master

More information

Strings and Testing string methods, formatting testing approaches CS GMU

Strings and Testing string methods, formatting testing approaches CS GMU Strings and Testing string methods, formatting testing approaches CS 112 @ GMU Topics string methods string formatting testing, unit testing 2 Some String Methods (See LIB 4.7.1) usage: stringexpr. methodname

More information