[SciPy-user] How to solve name mangling ?

Steve Schmerler elcorto@gmx....
Thu Jun 7 17:40:03 CDT 2007


Stefan van der Walt wrote:
> 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).

Agreed. Sometimes this can be useful (read: makes things more explict, but also more
static). You have to pay attention to stuff like that, but with a #comment here and
there, it's all OK. The power and flexibilty of Python/numpy/scipy weighs much more
than this.

>>
>> 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.
> 

Beeing as explict as possible (e.g. scipy.integrate.odeint(...)) is a good thing.
If you can be explicit, be it :)

-- 
cheers,
steve

I love deadlines. I like the whooshing sound they make as they fly by. -- Douglas Adams



More information about the SciPy-user mailing list