[Dev] a poll: slightly different python syntax

Phillip J. Eby pje at telecommunity.com
Thu Aug 11 16:39:19 PDT 2005


At 04:29 PM 8/11/2005 -0700, John Anderson wrote:
>I mildly prefer the class.classMethod syntax. In some cases I could 
>imagine more than one classMethod to create an Item.

I also prefer it, because it gives you more opportunity to look up the 
template() or make() method and find out what it does.


>In your example below, it's unclear which parenthesis matches the one just 
>before ".install(...

It would probably be better formatted more like:

Menu.template('FileMenu', _('File'), childrenBlocks=[
     MenuItem.template('NewNote', _('New Note..'), ...),
     MenuItem.template(...),
]).install(parcel)

Or, if the other parameters to the outermost template require more than one 
line:

Menu.template('FileMenu', _('File'),
     otherParam=....,
     childrenBlocks=[
         MenuItem.template('NewNote', _('New Note..'), ...),
         MenuItem.template(...),
     ]
).install(parcel)

The nesting is somewhat deeper in that case, but more readable, at least 
for me.



More information about the Dev mailing list