【发布时间】:2010-10-31 13:25:42
【问题描述】:
在 python 中可以使用 '.'为了访问对象的字典项。例如:
class test( object ) :
def __init__( self ) :
self.b = 1
def foo( self ) :
pass
obj = test()
a = obj.foo
从上面的例子中,有一个'a'对象,是否有可能从中获得对'obj'的引用,它是分配给'foo'方法的父命名空间?比如把obj.b改成2?
【问题讨论】: