ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pygame-users
pygame-users
Re: [pygame] Ridiculously simple way to seperate game-object code
by Lenard Lindstrom other posts by this author
May 20 2006 1:25PM messages near this date
Re: [pygame] Ridiculously simple way to seperate game-object code | BUG: mac cursor problem. Re: [pygame] new pygame release comming soon! Get your patches, and bug reports in!
On 20 May 2006 at 8:51, Kris Schnee wrote:

>  Doesn't Python have a "compile" function that turns a complex statement 
>  into an executable code block? Something like that could be used for 
>  if-branches and the like. So could a kludge like turning if/then 
>  branches into GOTO statements; this could be done by some quick run-time 
>  parsing, eg:
>  
It's a builtin function:

compile(source, filename, mode[, flags[, dont_inherit]]) ->  code
      object

Compile the source string (a Python module, statement or expression)
into a code object that can be executed by the exec statement or 
eval().

The filename will be used for run-time error messages.
The mode must be 'exec' to compile a module, 'single' to compile a
single (interactive) statement, or 'eval' to compile an expression.

The flags argument, if present, controls which future statements 
influence the compilation of the code.

The dont_inherit argument, if non-zero, stops the compilation 
inheriting the effects of any future statements in effect in the code 
calling compile; if absent or zero these statements do influence the 
compilation, in addition to any features explicitly specified.

Lenard Lindstrom
<len-l@[...].net> 
Thread:
James Hofmann
Sami Hangaslammi
James Hofmann
Kamilche
Adeola Bannis
Kris Schnee
Lenard Lindstrom

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved