Pdb;pdb.set_trace() alternative

A refinement for this trick!

<?python locals().update(econtext); import ipdb; ipdb.set_trace() ?>

or, for Python >= 3.7:

<?python locals().update(econtext); breakpoint() ?>

Which loads in the locals the variables defined in the template (econtext)!

9 Likes