[Python-Dev] Arbitrary attributes on funcs and methods

bwarsaw@cnri.reston.va.us bwarsaw@cnri.reston.va.us
Wed, 12 Apr 2000 14:00:52 -0400 (EDT)


>>>>> "SM" == Skip Montanaro <skip@mojam.com> writes:

    BAW> Functions and methods are first class objects, and they
    BAW> already have attributes, some of which are writable.

    SM> (Trying to read Fredrik's mind...)

    SM> By extension, we should allow writable attributes to work for
    SM> other objects.  To pollute this discussion with an example
    SM> from another one:

    |     i = 3.1416
    |     i.__precision__ = 4

    SM> I haven't actually got anything against adding attributes to
    SM> functions (or numbers, if it's appropriate).  Just wondering
    SM> out loud and playing a bit of a devil's advocate.

Python 1.6a2 (#26, Apr 12 2000, 13:53:57)  [GCC 2.8.1] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> i = 3.1416
>>> dir(i)
[]

Floats don't currently have attributes.

-Barry