call function in console without paranthesis

Wildemar Wildenburger wildemar at freakmail.de
Thu May 31 19:27:12 EDT 2007


Troels Thomsen wrote:
> Hello,
>
> I am wondering if I can write some code, that allows me to call functions in 
> the console , IDLE, without using the paranthesis notation. Like print.
> This will improve "intreractive'ness"
>   
Matlab-like, right?

In a nutshell: No, not possible in python *itself*.
I'm not a python-guru, but I'm pretty sure that this would require 
changes to the python sources, because what you ask for would basically 
be a new language (syntax) feature.

But if you really need that, you could try to write your own parser. You 
would have to think *hard* to get the semantics right, but in principle 
all you would have to do is translate your "simplified" console-input to 
valid python code and feed that to the exec() function (I think). At 
least, that's how I would do it.

/W



More information about the Python-list mailing list