[Python-Dev] New include statement (original) (raw)

Ebbinge, Onno Onno.Ebbinge@logicacmg.com
Wed, 2 Jul 2003 13:31:40 +0100


Wouldn't it be very useful if it would be possible to include C header files so that you could easily access to the local shared libraries (e.g., a .so or .dll)? A simple example:

include <time.h> secs = time.time(None) tm = time.localtime(secs) print 'The time is (ANSI format): %d-%d-%d %d:%d:%d\n' % ( ... tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, ... tm.tm_min, tm.tm_sec) The time is (ANSI format): 2003-7-2 13:52:31

Ok, the standard C time.h is totally not interesting in Python because it has it's own time module, but able to access other (os specific!) shared libraries is very useful! Access to ufs/ufs/quota.h on my FreeBSD box would be very simple this way (instead of wrapping/compiling/etc the whole thing).

The new include statement should wrap #define's, struct's, function declarations and such found in the header files in a module object. This would be a very general way to access shared libraries and OS API's. I even think it would dramatically simplify the standard or third party modules for python.

But... is this possible? Would it have the big advantages I think it would have?

Please CC me in your reply because I'm not on the python-dev list.

Sincerely,

Onno Ebbinge

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.