[Python-Dev] Object customization (was: Arbitrary attributes on funcs and methods)
Gordon McMillan
gmcm@hypernet.com
Fri, 14 Apr 2000 12:32:42 -0400
Fredrik Lundh wrote:
> -1 on static function variables implemented as
> attributes on function or method objects.
>
> def eff():
> "eff"
> print "eff", eff.__doc__
>
> def bot():
> "bot"
> print "bot", bot.__doc__
>
> eff()
> bot()
>
> eff, bot = bot, eff
>
> eff()
> bot()
>
> # or did your latest patch solve this little dilemma?
> # if so, -1 on your patch ;-)
To belabor the obvious (existing Python allows obsfuction), I
present:
class eff:
"eff"
def __call__(self):
print "eff", eff.__doc__
class bot:
"bot"
def __call__(self):
print "bot", bot.__doc__
e = eff()
b = bot()
e()
b()
eff, bot = bot, eff
e = eff()
b = bot()
e()
b()
There's nothing new here. Why does allowing the ability to
obsfucate suddenly warrant a -1?
- Gordon