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
The March To 3
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
daniellindsley
April 08, 2013
Technology
150
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The March To 3
The How's and Why's of porting to Python 3.
daniellindsley
April 08, 2013
More Decks by daniellindsley
See All by daniellindsley
The Unenviable Tutorial
daniellindsley
3
150
How (Not) To Build An OSS Community
daniellindsley
1
260
Avoiding The Search Hall Of Shame
daniellindsley
3
440
API Design Tips
daniellindsley
14
3.9k
Building A Python-based Search Engine
daniellindsley
20
2.6k
RESTful APIs with Tastypie
daniellindsley
19
2.9k
Django Boston - 2011
daniellindsley
4
280
Getting The Most Out Of Haystack
daniellindsley
5
250
Other Decks in Technology
See All in Technology
白金鉱業Meetup_Vol.24_「AIエージェントは分けるほど良い」は本当か? / Is it true that “the more you divide AI agents, the better”?
brainpadpr
1
420
インシデントレスポンス演習 I / Incident Response Exercise I
ks91
PRO
0
100
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
270
AI時代のコスト管理を考えよう〜明日から使える実践AWSノウハウ~
yoshimi0227
0
330
ACE-Step-1.5で見る 音楽生成AIのしくみと“破綻だけ直す”Retake機能の開発【zennfes spring 2026 登壇資料】
personabb
1
540
FPGAの開発コンペでZephyrを使ってみた
iotengineer22
0
150
MUSUBI 田中裕一『AIと共に行う「しごとのリデザイン」- スモールバックオフィス編』AI Ops Lab #4
musubi
0
280
iOS アプリの「これって不具合ですか?」を AI に調べてもらう
miichan
0
110
SONiCの統計情報を取得したい
sonic
0
240
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
360
アンオフィシャルな、オフィシャルからのお願い
wyamazak_devrel
0
140
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
190
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
The Invisible Side of Design
smashingmag
302
52k
We Are The Robots
honzajavorek
0
250
Paper Plane (Part 1)
katiecoart
PRO
0
9.1k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
30 Presentation Tips
portentint
PRO
1
330
Exploring anti-patterns in Rails
aemeredith
3
410
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
150
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
140
Making Projects Easy
brettharned
120
6.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Spectacular Lies of Maps
axbom
PRO
1
820
Transcript
The March To3
Who? • Daniel Lindsley • Pythonista since 2003 • Djangonaut
since 2006 • Author of Tastypie / Haystack / itty / others
None
Your language is...
Your language is... DEAD
Your language is... DEAD ...for small values of “dead”.
None
None
⦸
None
None
⦸
None
is dead;
is dead; Long live !
None
Why port to Python 3?
Active Development Python 2.7.x will only get security updates. No
Python 2.8 ever.
As Fast As 2.7 With 3.3 & it’ll only get
better.
Cleaned Up Syntax We’ll get to some of these in
a bit.
Better String Handling Unicode everywhere.
Stable
None
Changes from 2 to 3 •Removals • Backticks, classic classes
• <>, apply, reduce, dict.has_key • Others
Changes from 2 to 3 •Changed • print is now
print() • next() is now __next__() • Better raise syntax • Metaclasses
Changes from 2 to 3 •Changed (cont.) • Faster Decimal
implementation • Reorganized & spruced up stdlib • Careful with I/O!
Changes from 2 to 3 •New! • Built-in OrderedDict •
String formatting • dict / set comprehensions • Generator delegation via yield from
Changes from 2 to 3 •New! (cont.) • Built-in virtualenv
support! • unittest2 by default! • World domination with importlib
None
“What versions should I support?”
“What versions should I support?” Simple answer: Python 2.6+ &
Python 3.3+
None
“So how do I port?”
IT DEPENDS!
Decide between... • A One-time port • A Combined 2
& 3 codebase ...or...
None
The One-time port
The One-time port • Ensure you have good test coverage
• Use 2to3 to convert the codebase • Run tests & fix until it passes
None
The Combined 2 & 3 codebase
The Combined 2 & 3 codebase • First, you need
a venv: •virtualenv -p python3 env3 •. env3/bin/activate
The Combined 2 & 3 codebase • Ensure you have
good test coverage • Require six as a dependency • Use six to patch over the differences • Run tests in Py3 & fix until it passes... • ...then run tests in Py2 & fix until it passes!
None
Using six in practice
Demo time.
None
More information • http://pyvideo.org/video/1730/python-33- trust-me-its-better-than-27 • http://pyvideo.org/video/1787/porting- django-apps-to-python-3 • http://pyvideo.org/video/1704/why-you-
should-use-python-3-for-text-processing • http://pythonhosted.org/six/
More information • http://www.dabeaz.com/python3io/ MasteringIO.pdf
Thanks! @daniellindsley https://github.com/toastdriven