Style question: Nicknames for deeply nested objects
Stephen Hansen
me+list/python at ixokai.io
Sun Jan 30 21:53:03 EST 2011
On 1/30/11 1:13 PM, rantingrick wrote:
> On Jan 30, 12:53 pm, Stephen Hansen <me+list/pyt... at ixokai.io> wrote:
>> OH MY GOD. How can someone be expected to understand what a function does!
>
> Yes, and also how decorators word and generators work, and ...
>
>> Be serious! You can't expect that of them.
>
> I don't. I don't expect anyone to write 10 lines of obfuscation code
> when just two will suffice. Maybe you should join the perl group as
> they would proud!
Riiight.
"suffice" doesn't mean what you think it means. Generally, if something
suffices -- it actually, you know, ... works.
My four lines of setup can get put into a library and treated as a
recipe if they don't want to get into understanding generators or
decorators: then its two lines to use, and those two lines are exactly
like your two lines except for two little details:
1. They add a function call to the syntax.
2. They actually work.
The OP doesn't have to understand decorators or generators if he doesn't
want to: though I encourage him to do so, as they are beautiful and
elegant tools that can very clearly and concisely help solve a lot of
problems.
Now, me? I wouldn't use the recipe, as I originally said in my response.
I'd just use a local variable. But the OP didn't like that, and he
wanted some indenting and whitespace to clearly demarcate where he
intended to use the local. So I gave him a way to do that.
You gave him... uh, what was it again?
Oh, right.
Nothing.
As usual.
--
Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20110130/9693450b/attachment-0001.sig>
More information about the Python-list
mailing list