Addition of specific example of great code from one of the listed repositories.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu với phần Reading Code và ví dụ howdoi/howdoi.py được liên kết. Soạn một phần giải thích chính thức về cách xử lý import của Python 2/3, luồng điều khiển và API nhất quán được mô tả trong issue, sau đó thêm phần này vào trang phù hợp. Công việc được xem là hoàn tất khi ví dụ và các điểm rút ra về mặt sư phạm của nó được đưa vào một pull request.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Batchfile
- Star
- 29.8k
- Fork
- 5.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của realpython/python-guide
-
Page 404 error Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
realpython/python-guide#1104 · 2 bình luận ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 62/100
realpython/python-guide#327 ·
-
PyZMQ improvements Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
realpython/python-guide#326 · 5 bình luận ·
-
@alex Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
realpython/python-guide#1194 ·
-
Development Team SAP Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
realpython/python-guide#1192 ·
Tất cả issue của realpython/python-guide
Issue tương tự
-
Link Checker Report Đang mởautomated issue report
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
felladrin/uo-is-not-dead#176 · 1 bình luận ·
-
Add link for tutorial Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Qiskit/qiskit-addon-sqd#376 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Seeed-Studio/wiki-documents#5655 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
MystenLabs/sui#28056 · 1 bình luận ·