[SciPy-user] How to solve name mangling ?
Stef Mientki
S.Mientki at ru.nl
Fri Jun 8 05:20:50 EDT 2007
Steve Schmerler wrote:
> 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 :)
>
Steve and Stefan (and my name is Stef and was Stephan ;-),
From a pure programmers point of view you might be fully right.
btw I don't want to start a flame war,
but from a non-programmers point of view (which is a growing group, me
falling somewhere in between),
reading the philosophy behind Python, I come to a totally different
conclusion
From what I remember some philosophical highlights are:
Python should be intuitively, simple, universal and allow many
solutions for the same problem.
To drive my car,
- I don't need to know the type of the spark-plug
- I don't need to know how many spark-plugs my car has
- I don't need to know if my car has any spark-plugs
- I might even have never heard of a spark-plug
To use Python,
- I need to know what an numpy array is
- I need to know what a numeric array is
- I need to know what an array array is
- I need to know what a scipy array is
- and maybe a few others ...
But I just want to use an array,
and I just want that the array always to behave the same,
even if I give the array to someone else.
Ok, a car has a much longer history than programming languages.
And "batteries included" is both the strong point and the weak point of
a language like Python.
From the viewpoint of the non-programmer,
who just wants to drive their car (without wanting to have a look inside
the car),
there is still no good answer :-(
cheers,
Stef Mientki
Kamer van Koophandel - handelsregister 41055629 / Netherlands Chamber of Commerce - trade register 41055629
More information about the SciPy-User
mailing list