Conditional Compilation for bytecode?

Don don_b at my-deja.com
Wed Jun 21 13:45:20 EDT 2000


I have some code that needs to run on Win32 and IRIX.

I thought I read somewhere that python had a sort of conditional
compilation that would generate different .pyc files depending on the
directives in the .py file.

i.e.
#ifdef WIN32
CreateProcess(...)
#else UNIX
fork()
#endif

But I can't seem to find this anywhere.  Do I need to do this?

if sys.platform = 'Win32':
   CreateProcess(...)
else:
   fork()

Does the byte code compiler optimize this so it doesn't check every
time?


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list