function attributes are like function objects

Sean Reifschneider jafo-pythonlist at tummy.com
Thu Jan 25 00:28:08 EST 2001


On Wed, Jan 24, 2001 at 08:28:12PM -0500, Roy Katz wrote:
>Reading the 'function attributes' thread and looking at users' needs... I
>have to ask... why function attributes?  why not function *objects*?

I haven't followet the discussion here, but when I read about fucntion
atributes in 2.1 I though "I wonder what took so long".  It didn't really
seem like they were missing so much as it seemed like they would act
more like everything else now...

Though it seems like Zope could have made do with callable objects instead
of using doc strings:

	>>> class foo:
	...    def __call__(self):
	...       print 'Foo is:', self.foo
	... 
	>>> f = foo()
	>>> f.foo = 1
	>>> f()
	Foo is: 1

Sean
-- 
 I would rather suffer defeat than have cause to be ashamed of victory.
                 -- Quintus Curtius
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python




More information about the Python-list mailing list