[SciPy-user] How to solve name mangling ?
massimo sandal
massimo.sandal at unibo.it
Mon Jun 11 09:59:43 EDT 2007
Giorgio Luciano ha scritto:
> I'm enjoying reading all those comments also because sometime metaphors
> a re risky to use ;)
> (it seems like in a episode of House M.D.) because I can reply..
> if you want to drive a car you need to have a license... ok
> but if you want to drive a car you dont' need to be a mechanich or a
> mechanic engineer and know how the engine works... otherwise i guess
> there will be really less car drivers .. ;)
Problem is, programming is a science in itself.
I do not work in informatics, nor I have ever studied the theory of
programming, and the only programming language I have a firm grasp of is
Python. Still, I don't feel that "programming should be easy for
everyone". Or better, it should be as easy as possible (I'm currenty
trying to self-learn C++, and it's quite hellish...) but not easier.
Otherwise we would all being coding with Logo. So, programming may be
hard, but we can't expect it must be easy for everyone. It must be just
as hard as it should be.
(By the way, this is the same mentality of "computers should be easy for
everyone". Computers are meta-tools, they are extremly complex objects.
Using them is correspondingly complex. The fact that every layman can
stay in front of a computer and write an email is a miracle of current
technology, not something ordinary. We can't expect for computers to
become much easier than they are today without being dumbed down: we
must instead expect people to be educated about them.)
IMHO, Python is just that: it is a really easy, ready-to-go language,
but with all the guts to do everything. In this context, namespaces are
a damn great Python feature, and using them correctly makes code:
- more readable (because you now that module.function() belongs to
module, whereas, by importing *, function() , you lose that information)
- more robust (because there is no clash of different modules)
- actually easier (because I do not have to worry that the function() I
write myself will clash with some other function() I have imported - I
had extremly quirky bugs due to that)
And it is an extremly simple concept to grasp, IMHO.
I also come from the early days of "from foo import *", and somewhere in
my apps there are remains of that bad habit. But everytime I can I
rewrite them correctly, because I quickly learned that importing * is
the wrong way.
m.
--
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"
snail mail:
Via Irnerio 48, 40126 Bologna, Italy
email:
massimo.sandal at unibo.it
tel: +39-051-2094388
fax: +39-051-2094387
-------------- next part --------------
A non-text attachment was scrubbed...
Name: massimo.sandal.vcf
Type: text/x-vcard
Size: 274 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20070611/93882001/attachment.vcf>
More information about the SciPy-User
mailing list