Just learned, or relearned, some things in Python I either never knew or had forgotten:
Create a custom list with arbitrary attribute without subclassing:
>>> type('jclist'), (list,), {'black': False})()
[]
>>> l=_
>>> l.black
False
>>> l.black=True
>>> l.black
True
I ended up not using that, but thought it was cool. Pretty sure I've subclassed list before for things I could have done with type.
Also, python3 -i program.py arg arg arg drops you into the interactive prompt after running a program, allowing you to examine globals and state.
last updated 2022-04-09 17:08:46. served from tektonic.jcomeau.com