modernize some Python code
Since we now require Python 3.6, we can use f-strings instead of format() to make the code more readable. * doc/org/tut01.org, doc/org/tut02.org, doc/org/tut03.org, doc/org/tut21.org, doc/org/tut24.org, doc/org/tut90.org, python/spot/__init__.py, python/spot/jupyter.py, tests/python/acc.py, tests/python/acc_cond.ipynb, tests/python/complement_semidet.py, tests/python/decompose.ipynb, tests/python/formulas.ipynb, tests/python/highlighting.ipynb, tests/python/ipnbdoctest.py, tests/python/ltlf.py, tests/python/parity.ipynb, tests/python/product.ipynb, tests/python/relabel.py, tests/python/satmin.ipynb, tests/python/stutter-inv.ipynb, tests/python/twagraph-internals.ipynb, tests/python/zlktree.ipynb: Use f-strings.
This commit is contained in:
parent
df44f7a5c2
commit
7ac570fa3f
23 changed files with 292 additions and 327 deletions
|
|
@ -189,14 +189,14 @@
|
|||
],
|
||||
"source": [
|
||||
"for i in ['spot', 'spin', 'lbt', 'wring', 'utf8', 'latex', 'sclatex', 'mathjax']:\n",
|
||||
" print(\"%-10s%s\" % (i, f.to_str(i)))"
|
||||
" print(f\"{i:10}{f.to_str(i)}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Formulas output via `format()` can also use some convenient shorthand to select the syntax:"
|
||||
"Formulas output via `format()` of f-strings can also use some convenient shorthand to select the syntax:"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -218,13 +218,13 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"print(\"\"\"\\\n",
|
||||
"Spin: {0:s}\n",
|
||||
"Spin+parentheses: {0:sp}\n",
|
||||
"Spot (default): {0}\n",
|
||||
"Spot+shell quotes: {0:q}\n",
|
||||
"LBT, right aligned: {0:l:~>40}\n",
|
||||
"LBT, no M/W/R: {0:[MWR]l}\"\"\".format(f))"
|
||||
"print(f\"\"\"\\\n",
|
||||
"Spin: {f:s}\n",
|
||||
"Spin+parentheses: {f:sp}\n",
|
||||
"Spot (default): {f}\n",
|
||||
"Spot+shell quotes: {f:q}\n",
|
||||
"LBT, right aligned: {f:l:~>40}\n",
|
||||
"LBT, no M/W/R: {f:[MWR]l}\"\"\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1050,7 +1050,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.7"
|
||||
"version": "3.11.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue