Code block literals

Dave Benjamin ramen at lackingtalent.com
Wed Oct 8 23:47:22 EDT 2003


In article <mailman.1065656361.21143.python-list at python.org>, Lulu of the Lotus-Eaters wrote:
> Dave Benjamin <dave at 3dex.com> wrote previously:
>|return { |x, y|
>|     print x
>|     print y
>|}
>|It's unambiguous because no dictionary literal would ever start with
>|'{|', it looks almost identical to a certain other language <g>
> 
> Btw. I think Dave is thinking of Ruby as that "certain other language."
> But Clipper/xBase used the same syntax for the same thing before Ruby
> was a glimmer in Matz' eye.  I'm not sure if that's where he got it
> though... it might be from somewhere older I don't know about.

Busted. =) I could be wrong, but I thought Ruby got its code blocks from
Smalltalk, since both languages support them, and both have collections that
support "collect", "select", and "invoke", aka "map", "filter", and
"reduce", using code blocks. The syntax isn't exactly the same, but it's
very similar.

My coworker used to be a Clipper programmer, and he gets a sparkle in his
eye when he reminisces about the code blocks of old.

Dave

-- 
.:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
: d r i n k i n g   l i f e   o u t   o f   t h e   c o n t a i n e r :




More information about the Python-list mailing list