{
div0;
py`
print('\n Brython: (re)evaluating cell')
from browser import document
print('\n __BRYTHON__',__BRYTHON__.__MAGIC__,'\n','-'*17,'\n')
def test(x, pattern):
print(f'''{x!r}''')
assert x == pattern, f'''{x!r} != {pattern!r}'''
test(f'''{1.23e-10:1.6}''', '1.23e-10') #py3:'1.23e-10'; brython(3.7.1):'1.23000e-1'
test(f'''{1.24e-10:1.15}''', '1.24e-10') #py3:'1.24e-10'; brython(3.7.1):'1.24000000000000e-1'
def echo(ev):
s = document["zone"].value
document["echo2"].text = f'Hello {s} !'
print(f'~ {s} ~')
btn = document["test"]; btn.unbind("click") # unbind, so re-evaluating this cell will be OK
btn.bind("click", echo)
`
return 'Brython test: btn.bind("click", echo) - this line is just a comment in observablehq'
}