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
87
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
87
GitRadar——毕业论文答辩
liushuaikobe
0
220
NoSQL & MongoDB
liushuaikobe
0
200
Other Decks in Programming
See All in Programming
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.6k
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
130
テーブルをDELETEした
yuzneri
0
130
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
150
What's New in Android 2026
veronikapj
0
240
Claude Team Plan導入・ガイド
tk3fftk
0
250
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
800
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
240
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
520
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
120
地域 SRE コミュニティ最前線 - ホンマでっかSRE勉強会
tk3fftk
0
290
Build-to-own AI: Agentic Development for Humans
inesmontani
PRO
0
160
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
230
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
Building Adaptive Systems
keathley
44
3.2k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
First, design no harm
axbom
PRO
2
1.2k
From π to Pie charts
rasagy
0
240
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
420
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
41k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
270
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
390
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
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