skip to main content

@tonyfast s notebooks

site navigation
notebook summary
title
semantically meaningful display outputs for notebooks
description
html is a data structure for visual information
cells
18 total
14 code
state
executed out of order
kernel
Python 3 (ipykernel)
language
python
name
python3
lines of code
37
outputs
6
table of contents
{"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.3"}, "widgets": {"application/vnd.jupyter.widget-state+json": {"state": {}, "version_major": 2, "version_minor": 0}}, "title": "semantically meaningful display outputs for notebooks", "description": "html is a data structure for visual information"}
notebook toolbar
Activate
cell ordering
1

semantically meaningful display outputs for notebooks

html is a data structure for visual information

2 1 outputs.
import jinja2, datetime; from IPython.display import HTML
env = jinja2.Environment(loader=jinja2.DictLoader(templates := {}), extensions=["jinja2.ext.loopcontrols"]);
env.globals.update(dispatch=(dispatch := {}))
env.filters.update(dumps=__import__("json").dumps,**vars(__import__("builtins")))
3

template type dispatcher

for need to generate appropriate semantics for different data structures. we'll use a dispatching dictionary to handle that work. when int or float types are found then the numeric templates is used, str types use the string , list and dict handle sequences and containers.

4 1 outputs.
5
6

function class module

7
8
9 1 outputs.
a
10
11 1 outputs.
'thanks for the fish'
12

vocab typeof property resource prefix

itemid itemprop itemref itemscope itemtype

13
14
15
16
17 1 outputs.
[int,
 float,
 str,
 tuple,
 list,
 dict,
 set,
 frozenset,
 super,
 re.Pattern,
 type,
 function,
 builtin_function_or_method,
 method,
 types.SimpleNamespace,
 datetime.datetime,
 datetime.timedelta,
 BaseException,
 os._Environ,
 mappingproxy,
 slice,
 range,
 bytes]
18 1 outputs.
<IPython.core.formatters.JavascriptFormatter at 0x7fdec0e53cd0>