[Python-Dev] Arbitrary attributes on funcs and methods
Christian Tismer
tismer@tismer.com
Wed, 12 Apr 2000 16:43:30 +0200
Fredrik Lundh wrote:
>
> Paul Prescod wrote:
> > * I need to associate a Java-style type declaration with a method so
> > that it can be recognized based on its type during Java method dispatch.
>
> class foo:
> typemap = {}
> def myfunc(self):
> pass
> typemap[myfunc] = typeinfo
Yes, I know that nearly everything is possible to be emulated
via classes. But what is so bad about an arbitrary function
attribute?
ciao - chris
p.s.: Paul, did you know that you can use *anything* for __doc__?
You could use a class instance instead which still serves
as a __doc__ but has your attributes and more.
Yes I know this is ugly :-))
--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship* http://starship.python.net
14163 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
where do you want to jump today? http://www.stackless.com