Python Feature Request: Add the "using" keyword which works like "with" in Visual Basic

7stud bbxx789_05ss at yahoo.com
Sat Apr 14 15:12:44 EDT 2007


On Apr 14, 12:57 pm, "7stud" <bbxx789_0... at yahoo.com> wrote:
> On Apr 14, 4:42 am, samj... at gmail.com wrote:
>
> > This also is
> > similar to the C++ "using" keyword which exposes the members of a
> > namespace to access without specifying the namespace scope for each
> > reference. For example after giving "using namespace std;" I can
> > change all references to "std::cout" to "cout", which is similar to
> > what I am proposing for Python now.
>
> ...which is a bad practice in C++.  When you expose the members of a
> namespace, you create the potential for name clashes with the names in
> your program.  Why would you want to infect Python with that problem?

Oh.  James Stroud's recommendation would fix that:

> I would favor a convention with leading dots
> to disambiguate from other variables.




More information about the Python-list mailing list