gratuitous new features in 2.0

Alex Martelli alex at magenta.com
Fri Aug 25 11:16:46 EDT 2000


"Roy Katz" <katz at Glue.umd.edu> wrote in message
news:Pine.GSO.4.21.0008250847320.4353-100000 at z.glue.umd.edu...
    [snip]
> That last point is what especially concerns me.  C++ is full of these
> one-context throw-away grammatical oddities such as 'unsigned short
> BIT_FIELD_NAME:   N' (the colon) and 'using namespace ...' (could you
> *ever* put anything other than 'namespace' in the 'using'
> declaration??)

Absolutely!!!  "using namespace X;" in C++ is somewhat like
"from X import *" in Python -- something that you are *VERY
RARELY* supposed to do!  It injects ALL names from X into
the current namespace, half-defeating namespaces' purpose.

The *normal* case of 'using' in C++ is, rather:
    using X::justonename;
which is somewhat akin to Python's:
    from X import justonename
i.e., injects into the current namespace just X::justonename
(in C++; in Python, X.justonename) as unqualified 'justonename'.


Alex






More information about the Python-list mailing list