PEP 359: The "make" Statement

Steven Bethard steven.bethard at gmail.com
Fri Apr 14 10:42:33 EDT 2006


Duncan Booth wrote:
> Steven Bethard wrote:
> 
>> Should users of the make statement be able to determine in which dict
>> object the code is executed?  The make statement could look for a
>> ``__make_dict__`` attribute and call it to allow things like::
>>
>>      make Element html:
>>          make Element body:
>>              make Element h1:
>>                  '''First heading text'''
>>              make Element h1:
>>                  '''Second heading text'''
> 
[snip]
> There is another effect which should be considered here. If you allow 
> Element to create an object to be used as the namespace, then as well as 
> doing special tracking when values are set in the namespace it can also 
> pre-seed it with names which magically appear in scope within the make.
> 
> e.g.
> 
> make Element html:
>     make Element body:
>         make Element p:
>             text('But this ')
>             make Element strong:
>                  text('could')
>             text(' be made to work')

This is nice.  I'll have to play around with it a bit to see how hard it 
would be to make it work.

STeVe



More information about the Python-list mailing list