Python is just as good as C++ for real apps
Chris Liechti
cliechti at gmx.net
Tue Jan 29 14:39:12 EST 2002
"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...
> 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.)
> This is a toy project of mine, it would at least allow to wrap
> C interfaces in python, without a compiler.
well the "without compiler" is nice but not easy.. some compilers have
nasty alignment rules. because of that i wrote the extension module
instead of parsing the header file directly. (the module is generated
automaticaly from the .h file)
chris
> Thomas
>
>
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list