Message4382

Author fabioz
Recipients fabioz, thobes
Date 2009-03-30.00:35:45
SpamBayes Score 3.4787184e-10
Marked as misclassified No
Message-id <1238373347.7.0.0379668348619.issue1294@psf.upfronthosting.co.za>
In-reply-to
Content
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'>
>>>
History
Date User Action Args
2009-03-30 00:35:47fabiozsetmessageid: <1238373347.7.0.0379668348619.issue1294@psf.upfronthosting.co.za>
2009-03-30 00:35:47fabiozsetrecipients: + fabioz, thobes
2009-03-30 00:35:47fabiozlinkissue1294 messages
2009-03-30 00:35:46fabiozcreate