[Python-Dev] Arbitrary attributes on funcs and methods

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Wed, 12 Apr 2000 11:47:56 +0200 (CEST)


Barry Warsaw wrote:
> 
> A number of people have played FAST and loose with function and method
> docstrings, including John Aycock[1], Zope's ORB[2].  Docstrings are
> handy because they are the one attribute on funcs and methods that are
> easily writable.  But as more people overload the semantics for
> docstrings, we'll get collisions.  I've had a number of discussions
> with folks about adding attribute dictionaries to functions and
> methods so that you can essentially add any attribute.  Namespaces are
> one honking great idea -- let's do more of those!

Barry, I wonder what for...

Just because there's a Python entity implemented as a C structure
in which we can easily include a dict + access functions?

I don't see the purpose of attaching state (vars) to an algorithm
(i.e. a function). What are the benefits compared to class instances?

And these special assignment rules because of the real overlap with
real instances... Grrr, all this is pretty dark, conceptually.

Okay, I inderstood: modules become classes, functions become instances,
module variables are class variables, and classes become ... 2-nd order
instances of modules. The only missing piece of the puzzle is a legal
way to instantiate modules for obtaining functions and classes dynamically,
because using eval(), the `new' module or The Hook is perceived as very
hackish and definitely not OO.

Once the puzzle would be solved, we'll discover that there would be only
one additional little step towards inheritance for modules. How weird!
Sounds like we're going to metaclass again...

-1 until P3K.

This is no so cute as it is dangerous. It opens the way to mind abuse.

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252