Clarify benefits of factory methods in Module 2

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

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

評価

難易度
2/5
見積もり時間
半日
初心者へのやさしさ
55/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
jupyter-notebook, python
領域
documentation

調査の方向性

Module 2 の static methods セクションから始め、factory methods の現在の説明を見直してください。要求された用語、根拠、datetime と polars の例を追加してください。セクションでこのパターンをいつ、なぜ使うのかを説明し、一覧にある例を含めれば完了です。

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

説明

The static methods section in Module 2 shows how to create factory methods but could better explain when and why to use them.

Current state

The notes mention it's "less cumbersome" to create instances, but the pedagogical value could be stronger.

Suggested improvements

  1. Name the pattern - Use the term "factory method" or "alternative constructor" so students can recognize and search for it

  2. Explain the "why" - Python doesn't support multiple __init__ signatures, so factory methods provide multiple construction paths with semantic clarity

  3. Add stdlib examples from datetime:

    • datetime.fromtimestamp()
    • datetime.fromisoformat()
    • date.fromordinal()
  4. Add examples from polars:

    • pl.read_csv(), pl.read_parquet(), pl.read_json() (module-level factories)
    • DataFrame.to_dict()pl.from_dict() round-trip
    • pl.from_numpy(), pl.from_pandas()

These examples show the pattern is pervasive in well-designed Python APIs.

主要言語
Jupyter Notebook
スター
8
フォーク
1
平均マージ
4分
マージ済み PR(30日)
1

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

DHI/python-package-development のほかの issue

DHI/python-package-development の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

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

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