On Mon, Feb 28, 2005 at 09:41:37PM +0100, Just wrote: > In article <[EMAIL PROTECTED]>, > Jack Diederich <[EMAIL PROTECTED]> wrote: > > > On Mon, Feb 28, 2005 at 04:02:37PM -0500, Benji York wrote: > > > Jack Diederich wrote: > > > >Ditto for me, plural implies list and singular implies instance, > > > >for (contact) in contacts: > > > > # do something with contact > > > > > > May I ask why you place the parenthesis in the for statement? > > > > I like the tuple-ness feel of it and frequently unpack multiple > > values in for loops. I also like the visual feel, it makes it > > easy to see what is being unpacked and what is the source. > > > > "for (one, two, three) in somelist:" > > versus > > "for one, two, three in sometlist:" > > > > Even with a colorizing editor (emacs) I find the first version > > easier to read. YMMV. > > But you're using it for _single_ values. That's like writing > > (val) = someFunction(...)
Your Milage May^H^H^HDoes Vary *wink* A quick grep of my source shows zero unparenthesized for loops, 266 with multiple unpacks and 492 iterating over single values. Actually a bit closer to even, 96 are 'for (i) in range(len(l)):' that were written before enumerate() came about. I just always use parenthesis in for loops and when creating/upacking tuples. I find it easier to read, except in the '(var) = func()' case. Other people never use them. *shrug* I find this impossible to get worked up about. What other people do in the privacy of their own codebase doesn't bother me one bit. My $0.01 bits, -Jack -- http://mail.python.org/mailman/listinfo/python-list