How to reload local namespace definitions in the python interpreter?

Steve Holden steve at holdenweb.com
Mon Apr 4 15:56:13 EDT 2005


Bill Mill wrote:
> On Apr 4, 2005 11:10 AM, Steve Holden <steve at holdenweb.com> wrote:
> 
>>Tim Jarman wrote:
>>
>>>test1dellboy3 at yahoo.co.uk wrote:
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>I am a beginner using the python interpreter. To reduce typing effort,
>>>>I created a module called "aliases.py" containing some aliases for
>>>>objects I commonly use like -
>>>>
>>>>aliases.py :
>>>>
>>>>
>>>>import filecmp, os, commands
>>>>
>>>>op = os.path
> 
> <snip>
> 
>>>By the way, are you aware of the import ... as ... idiom?
>>>e.g. import os.path as op
>>>
>>
>>This would, of course, require the user to qualify the names by
>>prefixing them with "op.".
>>
> 
> 
> What the OP listed above requires that too.
> 
I believe the OP was suggesting

   from aliases import *

which specifically loads the names in the module (or those specified in 
module.__all__) into the importing namespace for use without qualification.

regards
  Steve
-- 
Steve Holden        +1 703 861 4237  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/



More information about the Python-list mailing list