[SciPy-user] How to solve name mangling ?

Stefan van der Walt stefan@sun.ac...
Thu Jun 7 16:56:58 CDT 2007


Hi Stef

On Thu, Jun 07, 2007 at 11:19:57PM +0200, Stef Mientki wrote:
> the beauty of Python is that you can "rename" everything .
> In the languages I've been using up to now,
> an integer is an integer and stays an integer forever (has it's beauty too).
> 
> The modules I write for myself,
> I always start with the "dangerous":
>    form scipy import *

"Namespaces are one honking great idea -- let's do more of those!"  As
you found out the hard way, not using namespaces effectively leads to
problems.  The "dangerous" shouldn't be in quotation marks!

Why not use

import scipy as S

Thereby you protect yourself from other modules overwriting your
method and variables, without having to do much extra typing.

Cheers
Stéfan


More information about the SciPy-user mailing list