bignose+hates-spam at benfinney.id.au
Mon Sep 17 02:50:08 CEST 2007
Ivan Voras <ivoras at __fer.hr__> writes:
> I know it can be almost always done by using a temporary variable:
> tmp = some.big.structure.or.nested.objects.element
> tmp.member1 = something
> tmp.member2 = something
> but this looks ugly to me.)
To me, it looks explicit. Python programmers value explicit code.
In other words, this looks like the right way to do it. The
alternative you're looking for would be to make an implicit reference,
which would make the code harder to follow.
Note that in the specific case of an attribute of a module, the first
lone of the above example can be rewritten as::
from some.big.package.or.nested.module import element as tmp
which is at least as common as the assignment example above.
\ "The only tyrant I accept in this world is the still voice |
`\ within." -- Mahatma Gandhi |
More information about the Python-list