Корисник:Михајло Анђелковић/mtc (en)/proposal/python

Input is a piece of valid Python code, with a set of special pre-defined variables, and some limitations.

Rules / Limitations:

  1. Variables never change.

I'm using some examples to explain:

V object уреди

It's a mapping object, like dict, but only .get and .__getitem__ is defined.

print 'hello, world'
hello, world

print V['a']
{{#ifeq:{{{a|1}}}{{{a|2}}}|12|<span class="error">KeyError: a</span>|{{{a}}}}}

print V.get('a', 'hw')
{{{a|hw}}}

if 'a' in V:
    print V[V['a']]
else:
    print V['b']
{{#ifeq:{{{a|1}}}{{{a|2}}}|12|{{#ifeq:{{{b|1}}}{{{b|2}}}|12|<span class="error">KeyError: b</span>|{{{b}}}}}|{{#ifeq:{{{{{{a}}}|1}}}{{{{{{a}}}|2}}}|12|<span class="error">KeyError: {{{a}}}</span>|{{{{{{a}}}}}}}}}}

T object уреди

print T['a'](kw='v')
{{a|kw=v}}