On 13/05/2015 14:14, Martin Cerveny wrote:
>      for item in items:
>          if item['type'].startswith('child<'):
> -            list_node(path + '/' + item['name'])
> +            list_node((path if (path != '/') else '')  + '/' + item['name'])

I'm not sure which Python version introduced if...else.  The more
traditional idiom would be

        path != '/' and path or ''

Can you use it, and move the expression out of the 'for item in items'
loop into a variable?

Paolo

Reply via email to