[Python-Dev] Re: [Import-sig] Re: Proposal for a modified import mechanism.

Thomas Heller thomas.heller@ion-tof.com
Thu, 15 Nov 2001 15:41:28 +0100


From: "Just van Rossum" <just@letterror.com>
> Thomas Heller wrote:
> 
> >
> http://groups.google.com/groups?selm=9ss15a%2414snvc%242%40ID-59885.news.dfncis.de
> 
> Nice! Maybe I wouldn't have missed that if hadn't been part of the "IsPython
> really O-O?" thread...
Well, I had problems at that time posting at all, so finally it escaped
without a changed subject ;-)
> 
> I think it's worth playing with this stuff more. One improvement I would like to
> try is to update methods just like global functions: that way existing callbacks
> that are bound methods will also be updated.
Great idea!

> 
> Other nits:
> func_defaults and func_doc should definitely be updated, I'm not sure about
> func_dict.
> 
> General question: why if func_globals not a writable attribute?
Dont' know, but it can be modified (although this is dangerous):

>>> def f(): pass
...
>>> f.func_globals
{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__',
'__doc__': None, 'f': <function f at 0x00767F08>}
>>> f.func_globals.clear()
>>> f
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'f' is not defined
>>>

I intend to update this stuff stealing from your ideas, but probably
python-dev is not the correct place to discuss this (IMO).
Should I post it again (with a better subject) to python-list,
and we continue there?

Thomas