Addition of specific example of great code from one of the listed repositories.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 42/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- documentation
Direzione di ricerca
Inizia dalla sezione Reading Code e dall’esempio collegato howdoi/howdoi.py. Redigi una spiegazione formale della gestione degli import di Python 2/3, del flusso di controllo e dell’API coerente descritti nell’issue, quindi aggiungila alla pagina appropriata. Il lavoro sarà considerato completato quando l’esempio e i relativi insegnamenti pedagogici saranno inclusi in una pull request.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I absolutely love the Reading Code section, and I've been going through some of the repositories and identifying specific examples of why the code is good.
I was hoping to add one such example to the page. Specifically, from howdoi. It's virtually at the top of the codebase and it deals with standardizing the repository for Python 2 and 3.
https://github.com/gleitz/howdoi/blob/master/howdoi/howdoi.py
# Handle imports for Python 2 and 3
if sys.version < '3':
import codecs
from urllib import quote as url_quote
from urllib import getproxies
# Handling Unicode: http://stackoverflow.com/a/6633040/305414
def u(x):
return codecs.unicode_escape_decode(x)[0]
else:
from urllib.request import getproxies
from urllib.parse import quote as url_quote
def u(x):
return x
I think that there are two (and a half) key pedagogical takeaways from this.
The half takeaway is that supporting different versions of Python need not be a grueling task.
The remaining two are -
- Appropriate use of control flow for module imports and function creation
- Standardizing an API so that its source is indistinguishable to the rest of the code and functionality is consistent.
I haven't formally written this up yet, but if you think it would be a useful example, I can do that and submit a pull request.
- Lingua principale
- Batchfile
- Stelle
- 29.8k
- Fork
- 5.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di realpython/python-guide
-
Page 404 error Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
realpython/python-guide#1104 · 2 commenti ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
realpython/python-guide#327 ·
-
PyZMQ improvements Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
realpython/python-guide#326 · 5 commenti ·
-
@alex Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
realpython/python-guide#1194 ·
-
Development Team SAP Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
realpython/python-guide#1192 ·
Tutte le issue di realpython/python-guide
Issue simili
-
Link Checker Report Apertaautomated issue report
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
felladrin/uo-is-not-dead#176 · 1 commento ·
-
Add link for tutorial Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
Qiskit/qiskit-addon-sqd#376 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Seeed-Studio/wiki-documents#5655 · 2 commenti ·
-
type:content-error
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
stephrobert/blog-roadmap#15 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100