Python is just as good as C++ for real apps
Chris Liechti
cliechti at gmx.net
Tue Jan 29 15:35:07 EST 2002
"Thomas Heller" <thomas.heller at ion-tof.com> wrote in
news:a36v9a$169s93$1 at ID-59885.news.dfncis.de:
> "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...
:-)
[...]
> 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.
well i had structures of structures and arrays of structs etc...
i can write single values or entire structs/arrays as a list of bytes.
using it to modify the memory is no problem. my first version was
python only. it parsed the .h and created a nested class hierarchy.
however, because of the alingnment thing, i decided to use the c
compliler and sizeof/offsetof macros to get the correct information.
i think one of the bigger problems is parsing c code (header files) to
extract the struct (defines, typedefs, ...)
let us know if you have something usable. i can also show you my
python wrappers if you're interested (the .h parser is not that
reliable)
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list