nick coghlan uytankmfgmailcom guido van rossum wrote ill wait others jump bandwagon imo tempfile object would better bother caching may found slightly convincing example spending fairly enlightening evening browsing source code weakrefproxy way code works define every slot delegating proxied object handle call wrapping unwrapping proxied object needed normally transparent user due fact __getattribute__ one proxied methods c level delegated slot invocations return notimplemented set appropriate exceptions way shows fact operatorisnumber operatorismapping always return true proxy instance operatorissequence always return false due proxy type filling number mapping slots sequence slots ismapping isnumber issequence slated chopping block stdlib reorg arent yet probably weakrefproxy function actually goes additional effort get callable return right answer using different type one empty tp_call slot object weak referenced doesnt define __callable__ two separate weakref proxy types actually still exist py3k despite removal callable however prompted try experiment python 251 results didnt fill confidence regarding approach expecting 3rd party developers explicitly delegate special methods class demo def __index__self return 1 demo b weakrefproxya operatorindexa 1 operatorindexb traceback recent call last file line 1 typeerror weakproxy object interpreted index oops didnt even catch missing delegation proxy implementation __index__ added let alone anyone elses ive raised missing delegation issue 2592 2x approach using classic class implement delegation via __getattr__ since classic classes specialcased everywhere go hook even c code removed py3k would probably worthwhile project take weakrefproxy code come equivalent version retained strong reference original object able subclassed weakrefproxy doesnt permit subclasses id expect including pure python version would better writing c lot easier write maintain still faster using classic class would written python allows pure mixin class wont restrict subclasss ability inherit class written c full proxy implementation standard library third party developers check proxy implementations explicitly delegating least range special methods standard library implementation cheers nick nick coghlan uytankmfgmailcom brisbane australia httpwwwboredomandlazinessorg _______________________________________________ python3000 mailing list smsbmo9552pythonorg httpmailpythonorgmailmanlistinfopython3000 unsubscribe httpmailpythonorgmailmanoptionspython3000python300040tangomucom thu 07 aug 2008 204150 1000 python3000 method populate tp_ slots via getattr