On Wed, 12 Apr 2000, Skip Montanaro wrote:
BAW> Functions and methods are first class objects, and they already BAW> have attributes, some of which are writable.
(Trying to read Fredrik's mind...)
By extension, we should allow writable attributes to work for other objects. To pollute this discussion with an example from another one:
i = 3.1416 i.__precision__ = 4
I haven't actually got anything against adding attributes to functions (or numbers, if it's appropriate). Just wondering out loud and playing a bit of a devil's advocate.
Numbers have no attributes right now. Functions have mutable attributes (__doc__). Barry is allowing them to be annotated (without crushing the values into __doc__ in some nasty way). Paul gave some great examples. IMO, the Zope "visibility by use of __doc__" is the worst kind of hack :-) "Let me be a good person and doc all my functions. Oh, crap! Somebody hacked my system!" And the COM thing was great. Here is what we do today: class MyCOMServer: _public_methods_ = ['Hello'] def private_method(self, args): ... def Hello(self, args) ... The _public_methods_ thing is hacky. I'd rather see a "Hello.public = 1" in there. Cheers, -g -- Greg Stein, http://www.lyra.org/