Import concerns revisited

Bill Baxter Bill_member at pathlink.com
Mon Jul 10 18:20:59 PDT 2006


In article <e8usq9$30df$1 at digitaldaemon.com>, Walter Bright says...
>
>Dave wrote:
>> I'm not sure what exactly Kris said, but imports are ubiquitous.
> > Not used as much as loops of course, but they are used in every program.
>
>Yes, they are ubiquitous. But the renaming of imported symbols? I'm not 
>convinced that is at all ubiquitous, or that it is very desirable in any 
>but unusual cases.

Renaming imported symbols is pretty common in Python, I think.
from numpy import transpose as T
was one I used myself recently.

Renaming namespaces in python is quite common too.  A lot of numpy users seem to
always start with this:
import numpy as N

Also I seem to be seeing it more in recent C++ programs (aliasing the whole
namespace, anyway, which is all C++ gives you) -- 
namespace NCF = a_really_long_namespace_called_foo


Also note that the current D import behavior corresponds to this in Python:
from some_module import *
which is something they say you should "avoid whenever *reasonably* possible".

--Bill





More information about the Digitalmars-d mailing list