Add Type Hints section to More Language Features lecture#488
Conversation
Adds a compact section on Python type hints to the python_advanced_features lecture, covering: - Basic syntax (function parameters, return types, variable annotations) - Common built-in types and container type syntax - Demonstration that hints are not enforced at runtime - Why type hints matter (readability, IDE support, error checking, LLM code) - Connection to scientific Python and JIT compilation Closes #343
|
Very nice :-) BTW, I remember that last year the PRs were listing changed lectures (links to deployment lectures), making it easier to click through and see changes. Is that infrastructure still available? |
|
nice catch @jstac -- it looks like I haven't updated lecture-python-programming. Direct lecture linking is in python.quantecon.org repo (but not here). I'll roll out our quantecon/actions/netlify-preview action across the board. LGTM. |
|
|
Thanks @mmcky Is there a way to automate this across the repos, along with updates to styles etc? Is it worth revisiting the one-big-repo idea? Just tossing ideas around -- I don't really know the upsides and downsides... |
thanks @jstac I am actually running this PR over https://github.com/quantEcon/action-style-guide right now as a test case. This automation is still in work -- too much noise (I don't want to add noise -- only value). |
Lowercase section headings to capitalize only the first word and proper nouns (e.g., Python), per QuantEcon style rules.
Apply sentence case to all section headings (##, ###, ####) across the entire lecture, not just the new Type Hints section. Only the first word and proper nouns (e.g., Python) are capitalized.
|
Applied qe-writing-006 (sentence-case headings) across the entire lecture — not just the new Type Hints section. Fixed 14 headings total to capitalize only the first word and proper nouns. |
Change bold to italic for emphasis (not definitions): - 'skip it on first pass' (pre-existing) - 'ignored by the Python interpreter at runtime' - 'not enforced' - 'clarity and tooling support'
|
Style fix (qe-writing-005): Changed bold to italic in 4 places where formatting was used for emphasis rather than definitions:
Bold remains for the |
|
@jstac this looks good to me now. I'll merge this. thanks for casting an eye over it. |
|
Thanks @mmcky, looks good. |
There was a problem hiding this comment.
Pull request overview
Adds a new, compact “Type hints” section to the More Language Features lecture, positioned between the */** operators content and the decorators section, to introduce annotations and their practical benefits in scientific Python.
Changes:
- Introduces a new “Type hints” section covering syntax, common types, and runtime behavior.
- Adds a short discussion of why type hints are useful (readability, tooling, static checkers, LLM-generated code).
- Updates various headings/emphasis around the insertion point (capitalization/styling).
|
\translate-resync |
✅ Translation sync completed (zh-cn)Target repo: QuantEcon/lecture-python-programming.zh-cn
|
✅ Translation sync completed (fa)Target repo: QuantEcon/lecture-python-programming.fa
|
Summary
Adds a compact new section on Python type hints to the More Language Features lecture, placed between the Operators section and Decorators.
Content
Design Decisions
Closes #343