Named code blockes
Alex Martelli
aleaxit at yahoo.com
Mon Apr 23 16:48:51 EDT 2001
"Stephen Hansen" <news at myNOSPAM.org> wrote in message
news:ic%E6.195119$LO3.31059618 at typhoon.we.rr.com...
[snip]
> With the advent of nested_scopes, I believe you can accomplish this by
> just embedding a 'def' in either the __init__ or the collection.do
function,
> making your code as readable as that smalltalk code was. :)
>
> For instance:
>
> class Dummy:
> def __init__(self, collection):
> def DoThisAndDoThatToItem(item):
> item.DoThis()
> item.DoThat()
>
> collection.do(DoThisAndDoThatToItem)
I don't get it -- what difference do nested scopes do to THIS code? It
will run identically with or without nested scopes. What am I missing?
Alex
More information about the Python-list
mailing list