[Python-Dev] A bit faster access to module attributes (original) (raw)
Guido van Rossum guido@python.org
Tue, 01 Jul 2003 12:27:46 -0400
- Previous message: [Python-Dev] A bit faster access to module attributes
- Next message: [Python-Dev] Re: [Python-checkins] python/dist/src/Lib threading.py,1.37,1.38
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>Have you found any situation where this particular operation was >>time-critical?
Each time a module's attribute is accessed with: from module import attr or module.attr a routine assigned to module tp->getattro is called (through PyObjectGetAttr, object.c,eval.c). Is it time-critical? As for small Python applications, no. However it probably could help in case of monsters like wxPython or Zope. (improving the applications startup performance as well).
Doesn't strik me as time-critical.
>>I believe (without thinking it through in detail) that the generic >>getattr/setattr routines are required in order to support subclassing >>of modules, which people use.
Adding tp->tpdict check->PyTypeReady-call to suggested new getattr/setattr routines wouldn't hurt much so subclassing could/will work, while "regular" modules could still benefit from suggested changes. >>So I think your suggestion cannot work, and I also think it is >>unnecessary, so I don't believe it is worth the bother. It works (tested). I wouldn't bother you otherwise. Well, all this is doable from a C extension module, so yes, modifying moduleobject.c is unnecessary. Sorry for taking your time.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] A bit faster access to module attributes
- Next message: [Python-Dev] Re: [Python-checkins] python/dist/src/Lib threading.py,1.37,1.38
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]