Python : highlights Based on T. K. Prasad’s slides.

Slides:



Advertisements
Similar presentations
Microsoft Research March 20, 2000 A Programming Language for Developing Interactive Web Services Claus Brabrand BRICS, University of Aarhus, Denmark.
Advertisements

Programming Languages and Paradigms
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Names and Bindings.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
1 Introduction to Data Types (Section 7.1) CSCI 431 Programming Languages Fall 2003 A compilation of material developed by Felix Hernandez-Campos and Michael.
Language of the Month If it’s December, it must be Ruby! Adam Coffman and Brent Beer.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
CSE S. Tanimoto Syntax and Types 1 Representation, Syntax, Paradigms, Types Representation Formal Syntax Paradigms Data Types Type Inference.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
1 A Short Introduction to (Object-Oriented) Type Systems Kris De Volder.
F# Shiva Srivastava David He Peter Bingel. Overview F# (pronounced "F sharp") is a functional and object oriented programming language for the Microsoft.NET.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
Language Evaluation Criteria
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
Imperative Programming
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
Programming language A programming language is an artificial language designed to communicate instructions to a machine,languageinstructionsmachine particularly.
1 CSC 533: Organization of Programming Languages Spring 2010 See online syllabus at: Course goals:  understand issues in designing,
Programming Languages and Paradigms Object-Oriented Programming (Part II)
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Hans-Peter Plag November 6, 2014 Session 4 (Programming Languages) (Data Types and Variables) Expressions and Operators Flow Control.
Semantics. Semantics is a precise definition of the meaning of a syntactically and type-wise correct program. Ideas of meaning: –Operational Semantics.
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
1 Generics Chapter 21 Liang, Introduction to Java Programming.
Python Functions.
Cs3180 (Prasad)LSysVsScipt1 Scripting vs Systems Programming Languages u Designed for gluing applications : flexibility u Interpreted u Dynamic variable.
Computer Science and Software Engineering© 2014 Project Lead The Way, Inc. Procedural Abstraction Object-Oriented Code.
Programming Languages
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Software Development Introduction
C H A P T E R T H R E E Type Systems and Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
CS190/295 Programming in Python for Life Sciences: Lecture 6 Instructor: Xiaohui Xie University of California, Irvine.
Programming Language Design Issues Programming Languages – Principles and Practice by Kenneth C Louden.
Python Programming Language by Vasu Chetty. Origins of Python Created by: Guido van Rossum, a Dutch Programmer Created during: Christmas Break, 1989 Created.
Review for Test 2 Chapters 5 (start at 5.4), 6.1, , 12, 13, 15.1, Python.
Programming Languages 2nd edition Tucker and Noonan
Programming in Go(lang)
CSC 533: Programming Languages Spring 2016
Polymorphism in Methods
The language focusses on ease of use
CSC 533: Programming Languages Spring 2015
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Types for Programs and Proofs
PROGRAMMING LANGUAGES
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
Lecture 16: Introduction to Data Types
Representation, Syntax, Paradigms, Types
Lecture 15 (Notes by P. N. Hilfinger and R. Bodik)
CS190/295 Programming in Python for Life Sciences: Lecture 6
Representation, Syntax, Paradigms, Types
Programming Languages 2nd edition Tucker and Noonan
Sridhar Narayan Java Basics Sridhar Narayan
Python Tutorial for C Programmer Boontee Kruatrachue Kritawan Siriboon
Arrays ICS2O.
Representation, Syntax, Paradigms, Types
Software Verification and Validation
Software Verification and Validation
Developer Productivity: What’s New in C# 6
Representation, Syntax, Paradigms, Types
Programming Languages and Paradigms
CS2013 Lecture 7 John Hurley Cal State LA.
Software Verification and Validation
Groovy.
Python fundamental.
Presentation transcript:

Python : highlights Based on T. K. Prasad’s slides

Versatile Improved Scripting : Replaced Bash Jython Snippets – Succinct code for JVM target: Replaced Java Short Programs

Striking Features Indentation based block structure promotes succinctness and improves readability Lack of separate variable/field declaration – Pros: Concise Code (with suitably chosen names) – Cons: Lack of redundancy for static checking Powerful and convenient string handling Useful collections – Lists, Dictionaries (maps), Tuples, Arrays, etc – Uniformity and Convenience: strings vs lists Numbers : int, long, float, complex

(cont’d) Dynamic typing – Pros: Supports heterogeneous data structures akin to Scheme – Cons: Certain type errors cannot be detected – Duck Typing is a style of dynamic typing in which an object's current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface.dynamic typingmethods Duck typing is aided by habitually not testing for the type of arguments in method and function bodies, relying on documentation, clear code, and testing to ensure correct use.

(cont’d) Multiparadigm Programming Language – Functional Style Views computation as a sequence of transformation – Imperative Style Views computation as a “large” sequence of “small” changes to the memory – Object-Oriented Style Views computation as interactions between a collection of computing agents (client-server paradigm)

List comprehension Imperative style for item in list: if conditional: expression Functional newlist =[expression for item in list if conditional]

List comprehension Imperative style y = [1, 2, 3] S=[] for v in y: s.append(v+1) Functional style – list comprehension y = [1,2,3] s = [ v+1 for v in y]

List comprehension import sys lines=[] for line in sys.stdin: if filter (line): # some function to determine the interesting lines lines.append(line) List comprehension: lines = [ line for line in sys.stdin if filter(line)]