Nadir Sampaoli wrote: > Qui, volendo, credo si possa anche togliere un paio di parentesi > intorno al generatore: > >> def depth(tree): >> return 1 if not tree else 1+max(depth(t) for t in tree)
E togliere un not invertendo la condizione logica (che brutti gli if con la negazione superflua): >>> def depth(tree): >>> return 1+max(depth(t) for t in tree) if tree else 1 -- Nicola Larosa - http://www.tekNico.net/ I hate code and I want as little of it as possible in our product. We don't have customers because we have lots of code: we have customers because we have lots of feature. - Jack Diederich, PyCon 2012 _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python