On Tue, 11 Apr 2000, Barry A. Warsaw wrote: > Here's the second go at adding arbitrary attribute support to function > and method objects. Note that this time it's illegal (TypeError) to > set an attribute on a bound method object; getting an attribute on a > bound method object returns the value on the underlying function > object. First the diffs, then the test case and test output. In the instancemethod_setattro function, it might be nice to do the speed optimization and test for sname[0] == 'i' before hitting the strcmp() calls. Oh: policy question: I would think that these attributes *should* be available in restricted mode. They aren't "sneaky" like the builtin attributes. Rather than PyMapping_Get/SetItemString()... PyObject_Get/SetItem() should be used. They apply to mappings and will be faster. Note that (internally) the PyMapping_Get/SetItemString use the latter forms (after constructing a string object(!)). ... whoops. I see that the function object doesn't use the ?etattro() variants. hrm. The stuff is looking really good! Cheers, -g -- Greg Stein, http://www.lyra.org/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4