PRs #984 (jv) and #985 (career) both introduced
and use jr.* throughout. These should be reverted to the spelled-out jax.random.* form.
Why
The manual specifies the spelled-out form. manual/styleguide/jax.md (Randomness section) gives:
key = jax.random.key(1234)
shocks = jax.random.normal(key, (100,))
with no alias. The jr alias was in the manual at one point and was deliberately removed in QuantEcon.manual#76, "Refactor JAX random example".
The alias is nonstandard. np and jnp are community conventions a reader arrives already knowing. jr is not — it is local to these two files. A reader who meets jr.split several hundred lines below the import has to scroll back to the top of the lecture to work out what it means. Our lectures are read linearly and often in fragments, so an alias that only pays off for the author is a net cost to the reader.
Affected call sites
lectures/jv.md — import at line 48, uses at 210, 485, 490.
lectures/career.md — import at line 60, uses at 399, 409, 415, 423, 427, 491, 503, 508, 519.
These are the only two files in the repo using the alias.
Related
QuantEcon/action-style-guide rule qe-jax-006 still shows import jax.random as jr together with jr.PRNGKey(42) as its recommended example. That is stale relative to the manual on two counts: the alias, and PRNGKey, which the manual now tells us to replace with jax.random.key. Worth fixing at the source so the checker stops recommending it in other lecture repos.
PRs #984 (
jv) and #985 (career) both introducedand use
jr.*throughout. These should be reverted to the spelled-outjax.random.*form.Why
The manual specifies the spelled-out form.
manual/styleguide/jax.md(Randomness section) gives:with no alias. The
jralias was in the manual at one point and was deliberately removed in QuantEcon.manual#76, "Refactor JAX random example".The alias is nonstandard.
npandjnpare community conventions a reader arrives already knowing.jris not — it is local to these two files. A reader who meetsjr.splitseveral hundred lines below the import has to scroll back to the top of the lecture to work out what it means. Our lectures are read linearly and often in fragments, so an alias that only pays off for the author is a net cost to the reader.Affected call sites
lectures/jv.md— import at line 48, uses at 210, 485, 490.lectures/career.md— import at line 60, uses at 399, 409, 415, 423, 427, 491, 503, 508, 519.These are the only two files in the repo using the alias.
Related
QuantEcon/action-style-guiderule qe-jax-006 still showsimport jax.random as jrtogether withjr.PRNGKey(42)as its recommended example. That is stale relative to the manual on two counts: the alias, andPRNGKey, which the manual now tells us to replace withjax.random.key. Worth fixing at the source so the checker stops recommending it in other lecture repos.