Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6634e15d
Kaydet (Commit)
6634e15d
authored
Mar 07, 2014
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #20812: Add a short opener to the Python 2/3 porting HOWTO.
Thanks to Nick Coghlan for the suggestion.
üst
5ccca951
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
pyporting.rst
Doc/howto/pyporting.rst
+30
-1
No files found.
Doc/howto/pyporting.rst
Dosyayı görüntüle @
6634e15d
...
@@ -26,6 +26,32 @@ Porting Python 2 Code to Python 3
...
@@ -26,6 +26,32 @@ Porting Python 2 Code to Python 3
For help with porting, you can email the python-porting_ mailing list with
For help with porting, you can email the python-porting_ mailing list with
questions.
questions.
The Short Version
=================
* Decide what's the oldest version of Python 2 you want to support (if at all)
* Make sure you have a thorough test suite and use continuous integration
testing to make sure you stay compatible with the versions of Python you care
about
* If you have dependencies, check their Python 3 status using caniusepython3
(`command-line tool <https://pypi.python.org/pypi/caniusepython3>`__,
`web app <https://caniusepython3.com/>`__)
With that done, your options are:
* If you are dropping Python 2 support, use 2to3_ to port to Python 3
* If you are keeping Python 2 support, then start writing Python 2/3-compatible
code starting **TODAY**
+ If you have dependencies that have not been ported, reach out to them to port
their project while working to make your code compatible with Python 3 so
you're ready when your dependencies are all ported
+ If all your dependencies have been ported (or you have none), go ahead and
port to Python 3
* If you are creating a new project that wants to have 2/3 compatibility,
code in Python 3 and then backport to Python 2
Before You Begin
Before You Begin
================
================
...
@@ -548,7 +574,10 @@ Backporting Python 3 code to Python 2
...
@@ -548,7 +574,10 @@ Backporting Python 3 code to Python 2
If you have Python 3 code and have little interest in supporting Python 2 you
If you have Python 3 code and have little interest in supporting Python 2 you
can use 3to2_ to translate from Python 3 code to Python 2 code. This is only
can use 3to2_ to translate from Python 3 code to Python 2 code. This is only
recommended if you don't plan to heavily support Python 2 users.
recommended if you don't plan to heavily support Python 2 users. Otherwise
write your code for Python 3 and then backport as far back as you want. This
is typically easier than going from Python 2 to 3 as you will have worked out
any difficulties with e.g. bytes/strings, etc.
Other Resources
Other Resources
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment