[Python-ideas] Python hook just before NameError

Chris Angelico rosuav at gmail.com
Mon Dec 29 12:50:17 CET 2014


On Mon, Dec 29, 2014 at 10:43 PM, Nathaniel Smith <njs at pobox.com> wrote:
> I just set up a PYTHONSTARTUP script to pre-import the obvious things and
> that fixed this problem for me. You'd still have to make a startup script to
> set up the hook, and it's not like 'import os, sys' will appreciably affect
> startup time.

Maybe those two won't, but I work with a number of Python students who
are using heavier libraries like psycopg2 and numpy, so I'd really
rather not auto-import those into everything. On the other hand, the
course is currently written for Python 2.7, so I can't actually make
use of this there... yet. Another reason to nudge the course writers
about updating to 3.x!

ChrisA


More information about the Python-ideas mailing list