Clarify benefits of factory methods in Module 2
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- Half a day
- Newbie friendliness
- 55/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- jupyter-notebook, python
- Domain
- documentation
Research direction
Start with the static methods section in Module 2 and review its current explanation of factory methods. Add the requested terminology, rationale, and datetime and polars examples; done means the section explains when and why to use the pattern and includes the listed examples.
Written by the indexing model from the issue text.
Description
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
-
Name the pattern - Use the term "factory method" or "alternative constructor" so students can recognize and search for it
-
Explain the "why" - Python doesn't support multiple
__init__signatures, so factory methods provide multiple construction paths with semantic clarity -
Add stdlib examples from datetime:
datetime.fromtimestamp()datetime.fromisoformat()date.fromordinal()
-
Add examples from polars:
pl.read_csv(),pl.read_parquet(),pl.read_json()(module-level factories)DataFrame.to_dict()→pl.from_dict()round-trippl.from_numpy(),pl.from_pandas()
These examples show the pattern is pervasive in well-designed Python APIs.
- Dominant language
- Jupyter Notebook
- Stars
- 8
- Forks
- 1
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DHI/python-package-development
-
Difficulty 2/5 1-2 days Newbie friendliness 88/100
-
Difficulty 2/5 1-2 days Newbie friendliness 72/100
DHI/python-package-development#37 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
All issues in DHI/python-package-development
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
A11y ♿️
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Link Checker Report Openautomated issue report
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
documentation improve or update documentation priority/low triage
Difficulty 2/5 Half a day Newbie friendliness 86/100
warpdotdev/docs#782 · 1 comment ·