[Python-Dev] Arbitrary attributes on funcs and methods

Greg Stein gstein@lyra.org
Wed, 12 Apr 2000 12:29:04 -0700 (PDT)


On Wed, 12 Apr 2000, Skip Montanaro wrote:
>...
>     BAW> Floats don't currently have attributes.
> 
> True enough, but why can't they?  I see no reason that your writable
> function attributes proposal requires that functions already have
> attributes.  Modifying my example, how about:
> 
>     >>> l = [1,2,3]
>     >>> l.__type__ = "int"
> 
> Like functions, lists do have (readonly) attributes.  Why not allow them to
> have writable attributes as well?

Lists, floats, etc are *data*. There is plenty of opportunity for creating
data structures that contain whatever you want, organized in any fashion.

Functions are (typically) not data. Applying these attributes is a way to
define program semantics, not record data.

There are two entirely separate worlds here. Adding attributes makes great
sense, as a way to enhance the definition of your program's semantics and
operation.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/