[Chicago] List revolution

Joshua Herman zitterbewegung at gmail.com
Sun Sep 11 00:37:12 CEST 2011


Something like
List = [1 , 2 , 3 , 4]
traverse n in List:
   n = n + 1
Would return

[2,3,4,5]

This is really syntactic sugar for

map(lambda x: x=x+1, List)
 
On Sep 10, 2011, at 5:33 PM, Tal Liron wrote:

> On 09/10/2011 05:20 PM, Joshua Herman wrote:
>> 
>> When I first learned python I thought lists were linked lists having
>> com e from a Lisp background. Although, what is probably most likely
>> that python could do is introduce a LinkedList class and keep the name
>> of Lists.
> Python has a lot of features inspired by functional languages: sequences, generators and (rather enervated) lambdas. I think the "for" and "yield" keywords support these very naturally and transparently for beginners and advanced programmers alike.
> 
> Of course, we can all implement LinkedLists, etc., on our own via classes and functions. What I'm personally missing in Python is a natural syntax for iteration and traversal, as natural as "for" is. This traversal would be able to handle everything from singly-linked lists, through double-linked lists, to graphs and hypergraphs. And, at the other end, something like "yield" that can cleanly generate these traversable structures.
> 
> Time for a PEP?
> 
> -Tal
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20110910/22099672/attachment.html>


More information about the Chicago mailing list