Python is just as good as C++ for real apps

Thomas Heller thomas.heller at ion-tof.com
Tue Jan 29 15:04:46 EST 2002


"Chris Liechti" <cliechti at gmx.net> wrote in message news:Xns91A5D295BC720cliechtigmxnet at 62.2.16.82...
> "Thomas Heller" <thomas.heller at ion-tof.com> wrote in
> news:a36j1b$15eigm$1 at ID-59885.news.dfncis.de:
> > What would you think about python plus raw pointers included?
>
> crashes? direct access to memory can be practical but is very error
> prone...
>

Of course.

But, good as Mark Hammonds win32 extensions are, you can also crash
Python easily with them. Maybe because it's impossible (even in the C layer)
to validate all the arguments you are passing to a function call, maybe
because it's just windows...

> > The ability to create/manipulate C-type structures in Python?
>
> thats a thing i needed last week in some way. i made an extension
> module that has tables with offsets, sizes, types and names of the
> structure members.
> a python module wraps those info and makes it possible to access the
> data like: "value = board.member.array[3].data.read()" etc. (the read
> could have been optimized away. the struct module does it thing to
> pack the data in strings to pass to the io functions, but that is
> completely transparent for the user.)
>
> (i don't needed to write to the memory directly, but instead call a
> function with offset and data, which reads/writes to a PCI card.)
Sure, it's not complicated in simple cases, you can (even now) do it
with the struct module (which also knows about the C compiler alignment
rules).

It gets tougher when you have nested structures, structures containing pointers,
and so on.

Have you seen the typeinfo data types on windows? I hope not...

Thomas





More information about the Python-list mailing list