Repository navigation
Commit b278ab4
committed
docs: correct what PyScript actually strips, and what dict == costs
Two claims stated more confidently than the code supports.
pyscript_component / ReactPyCsr: both pages said comments and docstrings are
stripped before inlining. minify_python (executors/pyscript/utils.py) removes
'#' comments and docstrings, but its docstring regex requires a newline before
the opening quotes and fetch_cached_python_file .strip()s the file first -- so a
module docstring is at byte 0 with no leading newline and survives. Measured on
the shipped wheel: module docstring reached the page, function docstring and
both comment styles did not. The security warning still holds (code and string
literals ship); it is now stated accurately rather than by overstating it.
choosing-the-state-structure: the Deep Dive said a rebuilt tree means comparing
'everything you just rebuilt'. dict.__eq__ compares lengths for free and stops
at the first differing entry, so cost tracks where the change sorts, not object
size. Measured on 100k-key dicts: changed key first ~0.00 ms, last ~1.3 ms,
identical content ~3 ms. Reworded so the advice (flatten for update-code
reasons, measure when it matters) survives the correction.1 parent 5430bc9 commit b278ab4
3 files changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
0 commit comments