howfeasiblewoulditbetocompilepython (possiblyviaanintermediatecrepresentation ) into machine代码?
presumablyitwouldneedtolinktoapythonruntimelibrary,andanypartsofthepythonstandardlibrarywhichwerepythonthemselveswouldneedto
Also,youwouldneedtobundlethepythoninterpreterifyouwantedtododynamicevaluationofexpressions,butperhapsasubsetofpythonthathatddididions
woulditprovideanyspeedand/ormemoryusageadvantages? presumablythestartuptimeofthepythoninterpreterwouldbeeliminated (althoughsharedlibrarieswouldstillneeedloadingatstartup )。
解决方案
Try ShedSkin Python-to-C compiler, butitisfarfromperfect.alsothereispsyco-pythonjitifonlyspeedupisneeded.butimhothisnotworththeeffort.for speed-critic