Addition of specific example of great code from one of the listed repositories.

オープン
#995 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
42/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
documentation

調査の方向性

Reading Code セクションと、リンクされている howdoi/howdoi.py の例から始めてください。Issue に記載されている Python 2/3 の import 処理、制御フロー、一貫した API について正式な説明を作成し、適切なページに追加してください。例とその教育的な要点が pull request に含まれれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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 -

  1. Appropriate use of control flow for module imports and function creation
  2. 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.

主要言語
Batchfile
スター
29.8k
フォーク
5.9k
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

realpython/python-guide のほかの issue

realpython/python-guide の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。