Importing from __future__ under the Python debugger pdb
This is mostly a short note about a question we encountered when planning a joint project with a company where students buy book reports so we decided to publish this information to help other programmers who end up looking for something like "why doesn't floating point division work in pdb".
Short version: the from __future__ import
magic doesn't work in pdb.
Long version: when debugging a program that (a) runs under Python 2 and (b) relies on from __future__ import division
to get floating point rather than integer division, it would be nice to have expressions typed at the pdb prompt behave the same way as expression evaluated in the file. However, this doesn't work:
$ python -m pdb test ...