[EMAIL PROTECTED] wrote:

> Bruno,
> 
> Please explain why the NOP import is a GoodThing. Use small words
> please. I'm not as young as I used to be.


Because otherwise every import would result in overhead without any benefit.
Think of a module like this:

--------

A_GLOBAL_VARIABLE = extremely_costly_initialization_of_cache_contents()

--------

You only want that to happen once.
 
> I didn't know about reload(), but now that I'm informed on that point
> I'm still using
> 
> os.remove('foo.pyc')
> reload(foo)
> 
> A single command to do that would be nice.

You can create your own function that does this.

def better_reload(module):
    import os 
    if os.path.exists(module.__file__) and module.__file__[-3:] == 'pyc':
       os.remove(module.__file__) # attention - you might want more checks
    reload(module)

Then you can put that into a file, e.g. 

~/.pythonrc

and point the environment-variable PYTHONSTARTUP to that file.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to