Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56023 > unrolled thread

Re: Style question: Nicknames for deeply nested objects

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2011-01-31 12:15 +0100
Last post2011-01-31 12:15 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Style question: Nicknames for deeply nested objects Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-01-31 12:15 +0100

#56023 — Re: Style question: Nicknames for deeply nested objects

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2011-01-31 12:15 +0100
SubjectRe: Style question: Nicknames for deeply nested objects
Message-ID<mailman.1494.1296472522.6505.python-list@python.org>
Gerald Britton wrote:
> Hi all,
>
> Today I was thinking about a problem I often encounter.  
> [snip]
>
> 1. You need to call this thing many times with different arguments, so
> you wind up with:
>
>    x = some.deeply.nested.object.method(some.other.deeply.nested.object.value1)
>    y = some.deeply.nested.object.method(some.other.deeply.nested.object.value2)
>    z = some.deeply.nested.object.method(some.other.deeply.nested.object.value3)
> [snip]
> --
> Gerald Britton
>   
This is not solved by style but by design.
You simply don't use too much nested objects. That's a sign of something 
wrong in your overall object model.

Since I do not encounter this problem as often as you are, I guess it is 
a matter of habbits.

however, considering what

"import a.module.that.is.quite.nested as myModule"

is doing, I guess using a local variable to store your nested method is 
just fine.

JM

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web