Download pptx - Python courses: lecture 1

Transcript
Page 1: Python courses: lecture 1

“Over six years ago, in December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus).”

Page 2: Python courses: lecture 1
Page 3: Python courses: lecture 1
Page 4: Python courses: lecture 1

Data typesBasic types

Container types

Numbers

int float complex decimal

Strings

str raw bytes chr

bytearray

SequencesList Tuple Set Dict

Bool NoneType

named tuple

frozen set

ordered dict

Main types

Class

Instance

Function

Type

deque

Page 5: Python courses: lecture 1
Page 6: Python courses: lecture 1
Page 7: Python courses: lecture 1
Page 8: Python courses: lecture 1

L.E.G.B rule

L, Local — Names assigned in any way within a function (def or lambda)), and not declared global in that function.E, Enclosing-function locals — Name in the local scope of any and all statically enclosing functions (def or lambda), from inner to outer.G, Global (module) — Names assigned at the top-level of a module file, or by executing a globalstatement in a def within the file.B, Built-in (Python) — Names preassigned in the built-in names module : open,range,SyntaxError,...


Recommended