How "return" no return ?
Michael Spencer
mahs at telcopartners.com
Thu May 12 15:11:15 EDT 2005
Ximo wrote:
> I am doing my own interpreter with the Python languaje.
>
> Do you understand me?
>
>
>
> "Fredrik Lundh" <fredrik at pythonware.com> escribió en el mensaje
> news:mailman.484.1115919541.29826.python-list at python.org...
>
>>"Ximo" wrote:
>>
>>
>>>I am doing a interpret of lines and it show me a prompt, and I want if I
>>>write a declaration as "int a" my progrtam return de prompt and nothing
>>>more, for exemple:
>>>
>>>
You may be looking for the flags argument to the compile function:
>>> exec compile("int(3)","<console>","single")
3
>>> exec compile("int(3)","<console>","exec")
>>>
>>> help(compile)
Help on built-in function compile in module __builtin__:
compile(...)
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.
>>>
Michael
More information about the Python-list
mailing list