Message4382
The results I got from Python 2.5 and 3.0 are below (both seem to accept
the form passed -- although one interprets it as a tuple and the other
from a method call, that form should be compatible across any version)
In Python 2.5.1
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> class Foo(object):
... def foo(self):
... exec('print self.__class__', {}, sys._getframe().f_locals)
...
>>> Foo().foo()
<class '__main__.Foo'>
>>>
In Python 3.0
Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> class Foo(object):
... def foo(self):
... exec('print(self.__class__)', {}, sys._getframe().f_locals)
...
>>> Foo().foo()
<class '__main__.Foo'>
>>> |
|
Date |
User |
Action |
Args |
2009-03-30 00:35:47 | fabioz | set | messageid: <1238373347.7.0.0379668348619.issue1294@psf.upfronthosting.co.za> |
2009-03-30 00:35:47 | fabioz | set | recipients:
+ fabioz, thobes |
2009-03-30 00:35:47 | fabioz | link | issue1294 messages |
2009-03-30 00:35:46 | fabioz | create | |
|