Idioms and Anti-Idioms Question
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Mon Jun 22 08:03:36 EDT 2009
In message <mailman.1941.1245668263.8015.python-list at python.org>, Wilbert
Berendsen wrote:
> I' prefer:
>
> value = (foo.bar()['first'][0] * baz.quux(1, 2)[5:9] +
> calculate_number(10, 20) * forbulate(500, 360))
I prefer using a two-dimensional layout to make the expression
structure more obvious:
value = \
(
foo.bar()['first'][0] * baz.quux(1, 2)[5:9]
+
calculate_number(10, 20) * forbulate(500, 360)
)
In this case it's not necessary, but if the factors were really long, this
could become
value = \
(
foo.bar()['first'][0]
*
baz.quux(1, 2)[5:9]
+
calculate_number(10, 20)
*
forbulate(500, 360)
)
More information about the Python-list
mailing list