On 30/09/2017 19:12, Stefan Ram wrote:
I would like to write source code similar to:
country( 'USA' )
state( 'Alabama' )
town( 'Abbeville' )
town( 'Addison' )
state( 'Arizona' )
town( 'Apache Junction' )
town( 'Avondale )
town( 'Benson' )
using "semantic indentation".
It seems I can't do this with Python.
Is there any workaround?
def country(x): print("C:",x)
def state(x): print("S:",x)
def town(x): print("T:",x)
def fn(*a): pass
fn(
country( 'USA' ),
state( 'Alabama' ),
town( 'Abbeville' ),
town( 'Addison' ),
state( 'Arizona' ),
town( 'Apache Junction' ),
town( 'Avondale' ),
town( 'Benson' )
)
This pretends they are arguments to a dummy function. But it probably
won't work with anything that isn't also an expression.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list