🌐 [translation-sync] [python_by_example.md] Update np.random → Generator API#114
🌐 [translation-sync] [python_by_example.md] Update np.random → Generator API#114
Conversation
✅ Deploy Preview for majestic-griffin-10b166 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-4-6 | Date: 2026-04-25 📝 Translation Quality
Summary: The translation of the modified sections is of high quality overall, with accurate technical content and good Persian fluency. The main issues are a typo ('blind' instead of 'bind') in The For Loop section, a subtle inaccuracy in the While Loop condition description, and a significant error in Exercise 2 where 'three time series' is mistranslated as 'one time series'. The Subpackages, Random Draws, and Version 1 sections are well translated with appropriate terminology and natural Persian phrasing. Technical terminology is consistently and accurately translated throughout all modified sections, following the reference glossary appropriately Mathematical notation and LaTeX expressions are preserved correctly in all modified sections including equations and variable names The translation of the Subpackages section accurately explains the concept of subdirectories and provides a clear Persian explanation The While Loops section correctly preserves the code structure and inline code references while providing clear Persian explanations The Exercises section maintains the mathematical formulas, exercise structure, and hint formatting correctly Suggestions:
🔍 Diff Quality
Summary: The translation document correctly mirrors all source changes, replacing legacy numpy random calls with the new rng-based API throughout all corresponding code cells, while preserving document structure, section order, and translation metadata unchanged. This review was generated automatically by action-translation review mode. |
There was a problem hiding this comment.
Pull request overview
Updates the Persian translation of python_by_example.md to use NumPy’s Generator-based random API (default_rng) instead of legacy np.random.* calls, in sync with the upstream lecture changes.
Changes:
- Replaced
np.random.randn()withrng = np.random.default_rng()+rng.standard_normal(...)across examples. - Replaced
np.random.uniform()withrng.uniform()in the Monte Carlo section. - Updated translation sync state metadata (source SHA, model, tool version, sync date/mode).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lectures/python_by_example.md |
Migrates random number generation examples to NumPy Generator API in the translated lecture. |
.translate/state/python_by_example.md.yml |
Updates translation-sync bookkeeping (sha/date/model/tool-version). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| بیاید به کدی که نویز سفید رسم می کند برگردیم. سه خط بعد از دستور Import به این صورت هستند: | ||
|
|
||
| ```{code-cell} ipython | ||
| ϵ_values = np.random.randn(100) | ||
| ϵ_values = rng.standard_normal(100) | ||
| plt.plot(ϵ_values) |
There was a problem hiding this comment.
The narrative says “three lines after the import” and the snippet starts with ϵ_values = rng.standard_normal(100), but the updated program now includes rng = np.random.default_rng() immediately after the imports. This section should be updated so the description and the displayed snippet reflect the new extra line (e.g., adjust the wording/count and/or include the rng = ... line in the snippet).
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python-programming.
Source PR
#538 - [python_by_example.md] Update np.random → Generator API
Files Updated
lectures/python_by_example.md.translate/state/python_by_example.md.ymlDetails
This PR was created automatically by the translation action.