list_a-list_b

Philip Swartzleonard starx at pacbell.net
Thu Apr 18 00:32:55 EDT 2002


Bengt Richter || Wed 17 Apr 2002 01:21:16p:

> On 17 Apr 2002 10:21:46 GMT, Philip Swartzleonard <starx at pacbell.net>
> wrote: [...]
>>Tim Peters || Tue 16 Apr 2002 10:54:56p:
> [...]
>>> 
>>> though.  Contrary to popular belief, there's no Fabulous Prize
>>> awaiting those who minimize either vertical or horizontal space
>>> <wink>. 
>>
>>Minimizing relative vertical space is great; that's why list 
>>comprehensions are better than nested for loops for expressing simple 
>>ideas ('i want var to be an x by y matrix of foozles' =), and why
>>moving stuff into subfunctions is nice. Horizontal space though...
>>feh. Unless you're using emacs default python mode, in a two or three
>>level deep looping structre in a function in a class, and you need to
>>write 'self.data[x][y].variable = self.long_function_name( lots, of,
>>arguments )' ... =)
> 
> If you want the form but not the looong one-liner:
> 
>     self.data[x][y].variable = (
>         self.long_function_name(
>             lots,
>             of,
>             arguments 
>         )
>     )
> 
> Hm, this makes me wonder if '=' could introduce an optionally indented
> expression block, using ident/dedent where the above is using = ( .. )

Well, the version of python-mode i've go t'would still put that as 

    self.data[x][y].variable = (
        self.long_function_name(
        lots,
        of,
        arguments 
        )
        )

Which is better than i thought it would be:

    self.data[x][y].variable = (
                                self.long_function_name(
                                                        lots,
                                                        of,
                                                        arguments 
                                                        )
                               )

But I still need to change it sometime =)

-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list