Can a simple a==b 'hang' in and endless loop?

Terry Hancock hancock at anansispaceworks.com
Thu Jan 19 12:00:42 EST 2006


On Thu, 19 Jan 2006 10:25:12 +0100
Claudio Grondi <claudio.grondi at freenet.de> wrote:
>  From the one side I am glad that Python cares about
>  memory allocation 
> for me, but on the other side I have trouble to accept,
> that I have no  direct access to the memory area where
> data are stored in order to  manipulate them. Having this
> possibility would enormously speed up some  conversions,
> because it were possible to get them down to a
> redefinition  of the data structure without being forced
> to loop over the actual  content or use a special
> extension library written in C for doing that.

It is precisely this power that makes C such a dangerous
language to program in -- it's what makes it so easy to
crash your program, any other program running on the same
machine, and shoot yourself and your dog each in the foot.

Sometimes you really do need that power, and isn't
it wonderful that we have C for those times?

If you find yourself really needing this kind of capability
in Python, then you can write an extension module to create
it.

As a compromise, BTW, there is also Pyrex, which gives you
C-like capabilities from a more Python-like language, and
was specifically created for making Python Extensions. I
believe, for example, that Soya 3D now uses Pyrex in
preference to C for highly-optimized code.

For everyday use, though, I recommend keeping the guard
rails firmly in place.

Imagine what the world would be like if we didn't have plugs
and outlets?  What if every time you wanted to move a lamp
you had shut off the power and rewire your house?  Safe
abstraction levels are a big time-saver.

-- 
Terry Hancock (hancock at AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com




More information about the Python-list mailing list