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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Shuai Liu
December 23, 2014
Programming
98
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
99
GitRadar——毕业论文答辩
liushuaikobe
0
260
NoSQL & MongoDB
liushuaikobe
0
230
Other Decks in Programming
See All in Programming
Inertia Rails: The One-Person Framework with React & Friends
skryukov
0
380
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
120
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
1.2k
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
5.1k
Next.js: The final boss of Web Performance
guaca
0
380
Event is what happens
moro
2
3.6k
JIS keyboard support in Omarchy
lef237
0
180
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
160
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
170
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2.2k
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
8.6k
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
620
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
520
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
610
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
The Cult of Friendly URLs
andyhume
79
7.1k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
350
Rails Girls Zürich Keynote
gr2m
96
14k
Faster Mobile Websites
deanohume
310
32k
Exploring anti-patterns in Rails
aemeredith
4
560
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
390
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
970
Side Projects
sachag
456
43k
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