[Python-Dev] Arbitrary attributes on funcs and methods

Skip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 12 Apr 2000 15:33:22 -0500 (CDT)


    me> >>> l = [1,2,3]
    me> >>> l.__type__ = "int"

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

Yeah, but there's no reason you wouldn't want to reason about them.  They
are, after all, first-class objects.  If you consider these other attributes
as meta-data, allowing data attributes to hang off lists, tuples, ints or
regex objects makes perfect sense to me.  I believe someone else during this
thread suggested that one use of function attributes might be to record the
function's return type.  My example above is not really any different.
Simpleminded, yes.  Part of the value of l, no.

Skip