[Python-Dev] anonymous blocks

Michael Walter michael.walter at gmail.com
Wed Apr 20 03:55:52 CEST 2005


On 4/19/05, BJörn Lindqvist <bjourne at gmail.com> wrote:
> > RSMotD (random stupid musing of the day): so I wonder if the decorator
> > syntax couldn't be extended for this kind of thing.
> >
> > @acquire(myLock):
> >     code
> >     code
> >     code
> 
> Would it be useful for anything other than mutex-locking? And wouldn't
> it be better to make a function of the block wrapped in a
> block-decorator and then use a normal decorator?

Yes. Check how blocks in Smalltalk and Ruby are used for starters.

Regards,
Michael


More information about the Python-Dev mailing list