why no ++?

Aahz Maruch aahz at panix.com
Tue Aug 14 10:43:01 EDT 2001


In article <9lan1301822 at enews1.newsguy.com>,
Alex Martelli <aleax at aleax.it> wrote:
>"Michael Abbott" <michael at rcp.co.uk> wrote in message
>news:Xns90FD5728D9CDAmichaelrcpcouk at 194.238.50.13...
>>
>> Oops!  Very true.  I should have rewritten it as
>>
>>     e = 'wow'
>>     b,c,d = 'wow'
>>     a = 'wow'
>>
>> Hmm.  The argument about obfuscation versus repetition comes more clearly
>> into focus.  I still think multiple assignment is a bad thing...
>
>So now consider:
>
>    y.a = b,c,d = x.e = wower()
>
>How would you like to rewrite _this_?-)  There is *NO* rewrite
>that ensures constant semantics except by introducing _another_
>temporary variable -- *yecch*!-)

So?  Doing tuple packing and unpacking in the middle of a multiple
assignment statement is error-prone for maintenance.  Get someone who
doesn't understand *precisely* what the above is doing, and your code
will likely malfunction under change.  I certainly wouldn't understand
it without a lot of checking, and I might well make a casual mistake if
I *thought* I understood it.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

Internet $tartup$: Arbeit ueber alles  



More information about the Python-list mailing list