Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Python-intro-2
Search
Shuai Liu
December 23, 2014
Programming
91
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
140
Python-intro-1
liushuaikobe
0
89
GitRadar——毕业论文答辩
liushuaikobe
0
220
NoSQL & MongoDB
liushuaikobe
0
200
Other Decks in Programming
See All in Programming
Android CLI
fornewid
0
240
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
1
2k
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
580
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.8k
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
390
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
620
Flow は今どうなっているか
mizdra
PRO
0
720
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
1
540
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
240
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.7k
Featured
See All Featured
Evolving SEO for Evolving Search Engines
ryanjones
0
260
The Spectacular Lies of Maps
axbom
PRO
1
940
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
220
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
650
The agentic SEO stack - context over prompts
schlessera
0
880
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
480
Believing is Seeing
oripsolob
1
200
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
410
Optimizing for Happiness
mojombo
378
71k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
My Coaching Mixtape
mlcsv
0
280
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