Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Python-intro-2
Search
Shuai Liu
December 23, 2014
Programming
97
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Python-intro-2
Shuai Liu
December 23, 2014
More Decks by Shuai Liu
See All by Shuai Liu
Auto-Layout.pdf
liushuaikobe
2
150
Python-intro-1
liushuaikobe
0
95
GitRadar——毕业论文答辩
liushuaikobe
0
260
NoSQL & MongoDB
liushuaikobe
0
220
Other Decks in Programming
See All in Programming
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
ActionController meets Protocol Buffers
sorah
0
520
SREの越境 / SRE Collaboration
y0hgi
2
310
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
Jetpack Compose Mechanisms
skydoves
3
820
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
590
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
The agentic SEO stack - context over prompts
schlessera
0
970
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
Believing is Seeing
oripsolob
1
240
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
440
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Odyssey Design
rkendrick25
PRO
2
870
The Cult of Friendly URLs
andyhume
79
7k
Transcript
Intro to Python by Shuai Liu
agenda • History & Basics • Advanced & Be Pythonic
• Awesome Python Frameworks
Advanced & Be Pythonic
Review • int & float & bool • string &
list & tuple • dict • loop & branch • def methods
Something interesting…
def foo(a, b): """My niubility methods.""" return a + b
"""My niubility methods.""" >>> print foo.__doc__ >>> My niubility methods.
class Person(object): """My first class""" version = 1.0 def __init__(self,
name): self.name = name print "__init__ called" def get_name(self): """Return the name""" return self.name
Pythonic
–Martijn Faassen, founder of the lxml (XML library for Python)
“Pythonic is to use the Python constructs and datastructures with clean, readable idioms.”
enumerate l = [0, 1, 2, 3, 4] for i
in range(len(l)): print i, l[i] for i, element in enumerate(l): print i, element
value exchange temp = foo foo = bar bar =
temp foo, bar = bar, foo
string concatenating s = “hello” + “world” s = “”.join([“hello”,
“world”])
λ
lambda def foo(x): return x ** 2 lambda x :
x ** 2 >>> a = lambda x : x ** 2 >>> a(5) >>> 25
filter & map & reduce
>>> filter(function, iterable) >>> map(function, iterable) >>> reduce(function, iterable)
filter
map
reduce
None
List comprehensions
>>> a = map(lambda x : x ** 2, range(10))
>>> a = [ x ** 2 for x in range(10)] >>> a = filter(lambda x : x % 2, range(10)) >>> a = [x for x in range(10) if x % 2]
None
two more things…
PEP
Python Enhancement Proposals num title owner 1 PEP Purpose and
Guidelines Warsaw, Hylton, Goodger, Coghlan 4 Deprecation of Standard Modules von Löwis 5 Guidelines for Language Evolution Prescod 8 Style Guide for Python Code GvR, Warsaw, Coghlan
pip
pip • A tool for installing and managing Python packages.
• $ sudo pip install Requests
Resources
None
IDE ‘+’.join([ , ])
IDE
Summary • OO • lambda & three functions • list
comprehensions • resources
Thanks