[Python-Dev] defmacro (was: Anonymous blocks)

Aahz aahz at pythoncraft.com
Mon Apr 25 20:49:34 CEST 2005


On Mon, Apr 25, 2005, Shane Holloway (IEEE) wrote:
>
> Interfaces::
> 
>     def interface(interfaceName, *bases, ***aBlockSuite):
>         blockGlobals = aBlockSuite.globals().copy()
>         blockGlobals.update(aBlockSuite.locals())
>         blockLocals = {}
> 
>         exec aBlock in blockGlobals, blockLocals
> 
>         return iterfaceType(interfaceName, bases, blockLocals)
> 
>     IFoo = interface('IFoo'):
>         def isFoo(self): pass

Where does ``aBlock`` come from?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It's 106 miles to Chicago.  We have a full tank of gas, a half-pack of
cigarettes, it's dark, and we're wearing sunglasses."  "Hit it."


More information about the Python-Dev mailing list