[Python-3000] pyvm module - low level interface to Python's VM

Barry Warsaw barry at python.org
Fri Nov 30 16:21:16 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 30, 2007, at 9:31 AM, Jean-Paul Calderone wrote:

> On Fri, 30 Nov 2007 11:35:18 +0100, Christian Heimes  
> <lists at cheimes.de> wrote:
>> Dirkjan Ochtman wrote:
>>> I don't know how hard it would be for Jython, IronPython et al. to
>>> support this kind of interface, but seeing as how something like
>>> zope.interface relies on it (and therefore all of Twisted, too, I
>>> think), it's kind of mandatory anyway.
>>
>> zope.interface could work without sys._getframe(). It's not mandatory
>> for its API. getframe is used for a clever hack which makes declaring
>> interfaces more convenient and readable.
>>
>> class Example:
>>    implements(IExample)
>>
>
> This is a current feature of zope.interface.  Therefore,  
> zope.interface
> requires it, unless you can show an implementation of this API  
> which does
> not depend on it.
>
> It is certainly true that this API could be removed from  
> zope.interface.
> At that time, zope.interface would not depend on these frame APIs.  It
> would also break almost every user of zope.interface and require  
> them to
> change to the new API.
>
> Don't try to mix "could work" with "does work" together.

This frame hacking is also a pretty common feature of other types of  
systems, such as ORMs.  It can make certain Python code much more  
readable, so "frame hacking" is clearly a useful feature, at least it  
seems, in the context of a class definition.  Is there a way to  
promote this to an API that's more principled than the sys._getframe 
() hack, and thus more acceptable to Guido and more portable to other  
implementations?

(Or is something like this already in Py3K, and I just haven't  
noticed it yet? ;).

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQCVAwUBR1AqbXEjvBPtnXfVAQIfUQQAnKd4ThlGtsUKcdoSj+lXa/4kHxZ5Znju
sOKEWM77pTZZorQuIJjib9UI9GfaZq+HR9lcRb00ztUspNZcX7x/cSMOKFKVQT+B
XiPGJvHpVttYc8Qb1bd/drcPJpK+cvXDBva10ivL8PnSzziMgV86gI1HzSoCxg4i
51X0uzuhLfE=
=Hvxa
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list