Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-24 Thread Heiko Wundram
Am Mittwoch 24 Mai 2006 06:12 schrieb Tim Roberts: At one time, it was said that the % operator was the fastest way to concatenate strings, because it was implemented in C, whereas the + operator was interpreted. However, as I recall, the difference was hardly measurable, and may not even

RE: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-24 Thread Delaney, Timothy (Tim)
Heiko Wundram wrote: Am Mittwoch 24 Mai 2006 06:12 schrieb Tim Roberts: At one time, it was said that the % operator was the fastest way to concatenate strings, because it was implemented in C, whereas the + operator was interpreted. However, as I recall, the difference was hardly

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-23 Thread Tim Roberts
Edward Elliott [EMAIL PROTECTED] wrote: bruno at modulix wrote: Edward Elliott wrote: You mean like this: s = foo + bar s = 'foo' + 'bar' s = 'foo' 'bar' s = '%s%s' % ('foo', 'bar') [snip] The real mantra is actually : There should be one-- and preferably only one --obvious way to do

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-22 Thread bruno at modulix
Edward Elliott wrote: George Sakkis wrote: Em Dom, 2006-05-21 às 17:11 +0200, Heiko Wundram escreveu: for node in tree if node.haschildren(): do something with node as syntactic sugar for: for node in tree: if not node.haschildren(): continue do something with node [snip] 2) There

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-22 Thread Boris Borcic
Heiko Wundram wrote: ... As I've noticed that I find myself typing the latter quite often in code I write, it would only be sensible to add the corresponding syntax for the for statement: for node in tree if node.haschildren(): do something with node as

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-22 Thread Heiko Wundram
Am Montag 22 Mai 2006 11:27 schrieb Boris Borcic: Mhhh, your unsugared form remind me of darks hours with primitive BASICS in my youth - the kind Dijsktra commented on. Why don't you write for node in tree: if node.haschildren(): do something with node As

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-22 Thread Edward Elliott
bruno at modulix wrote: Edward Elliott wrote: You mean like this: s = foo + bar s = 'foo' + 'bar' s = 'foo' 'bar' s = '%s%s' % ('foo', 'bar') [snip] The real mantra is actually : There should be one-- and preferably only one --obvious way to do it Please note the should, preferably,

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-22 Thread Russell E. Owen
+1 It does seem like a natural unificiation of the language -- one less exception to learn. -- Russell -- http://mail.python.org/mailman/listinfo/python-list

PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Heiko Wundram
Hi all! The following PEP tries to make the case for a slight unification of for statement and list comprehension syntax. Comments appreciated, including on the sample implementation. === PEP: xxx Title: Unification of for-statement and list-comprehension syntax Version: $Revision$

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread gangesmaster
i wanted to suggest this myself. +1 -tomer -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread KW
On 2006-05-21, Heiko Wundram wrote: Hi all! The following PEP tries to make the case for a slight unification of for statement and list comprehension syntax. Sounds great! -- Konrad -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Felipe Almeida Lessa
Em Dom, 2006-05-21 às 17:11 +0200, Heiko Wundram escreveu: for node in tree if node.haschildren(): do something with node as syntactic sugar for: for node in tree: if not node.haschildren(): continue do something with node

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread gangesmaster
Today you can archive the same effect (but not necessarily with the same performance) with: for node in (x for x in tree if x.haschildren()): do something with node true, but it has different semantic meanings -tomer -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Felipe Almeida Lessa
Em Dom, 2006-05-21 às 11:52 -0700, gangesmaster escreveu: Today you can archive the same effect (but not necessarily with the same performance) with: for node in (x for x in tree if x.haschildren()): do something with node true, but it has different semantic meanings I know,

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread George Sakkis
Felipe Almeida Lessa wrote: Em Dom, 2006-05-21 às 11:52 -0700, gangesmaster escreveu: Today you can archive the same effect (but not necessarily with the same performance) with: for node in (x for x in tree if x.haschildren()): do something with node true, but it has

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Edward Elliott
George Sakkis wrote: Em Dom, 2006-05-21 às 17:11 +0200, Heiko Wundram escreveu: for node in tree if node.haschildren(): do something with node as syntactic sugar for: for node in tree: if not node.haschildren(): continue do something with node [snip] 2) There should be one and

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Carl Banks
Heiko Wundram wrote: The following PEP tries to make the case for a slight unification of for statement and list comprehension syntax. -1 Adds complexity to the language and saves you nothing but an indent level. However, I encourage you to submit this PEP and get a (almost certianly

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Carl Banks
Edward Elliott wrote: Special cases aren't special enough to break the rules. (proposal eliminates the current special case for comprehensions/generators) It really isn't a special case, though. It might seem like it is, but it's not at all when you remember the rules of equivalence between