What to do after Python?

bowman bowman at montana.com
Mon Feb 19 15:47:42 CET 2001

Sheila King <sheila at spamcop.net> wrote in message
news:nlf19tge339tjh0eoiigvsimndjm45b990 at 4ax.com...
> It was explained to me, that by putting the statement
> using namespace std;
> in the program, I avoid the need to have to put the scope on each of these
> elements? (I know this is very far off topic now, for this group...)

it is the same as

import foo
from foo import bar
from foo import *

in the last case, and in the case of 'using namespace std' , there is the
potential for some variable or function in the imported module to conflict
with a name you are using in your module.

howver, if you say foo.bar() or std::ends, you have precisely and explicitly
chosen the module. Not a big deal for casual programming but when the line
count gets into the tens of thousands or more, and a number of programmers
are developing modules independently, sooner or later there will be two
bar's, and which one too use will require further resolution. The worse case
will be a weak compiler that will assume the wrong one and emit a warning.
Sad but true, but in large projects involving a great deal of older code,
one tends to ignore a lot of warnings, as many are innocuous.

More information about the Python-list mailing list