[Tutor] Newbie trying to understand modules and code reuse
Alan Gauld
alan.gauld at blueyonder.co.uk
Thu Feb 5 18:04:51 EST 2004
> Although the more recent versions of the C++ language
> do have a limited implementation of namespaces.
Actually its quite a sophisticated namespace mechanism, and in
some ways is better than Pythons(IMHO) - you can add names to a
namespace retrospectively, modify the scope of namespaces, have
multiple namespaces within a file, even within a function etc.
But it is entirely separated from the prinitive #include
functionality borrowed from C which is what I was referring to.
> #include <iostream.h>
> cout << "Hello World!\n"
> is now deprecated in favor of
> #include <iostream>
> std::cout << "Hello World!\n"
Indeed, although you can work some magic to remove the need
for the std:: but it has similar issues to using
from module import *
in Python.
Alan G.
More information about the Tutor
mailing list