Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56023
| Date | 2011-01-31 12:15 +0100 |
|---|---|
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| Subject | Re: Style question: Nicknames for deeply nested objects |
| References | <AANLkTi=CWsm7_R6av-0=d2JPfTq=MNaynnedpchF3s1T@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1494.1296472522.6505.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Style question: Nicknames for deeply nested objects Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-01-31 12:15 +0100
csiph-web