[Zope-dev] inheritedAttribute
Jim Fulton
jim@digicool.com
Mon, 28 Aug 2000 06:57:01 -0400
Steve Alexander wrote:
>
> In the latest Zope source, I've noticed calls to inheritedAttribute in
> the Python code.
>
> I've found the C source code in ExtensionClass.c, but it doesn't help me
> understand when I should use it from Python, and why.
>
> *reads more source*
>
> Ah! About 70 lines further on in ExtensionClass.c:
>
> "inheritedAttribute(class,name) -- Get an inherited attribute\n\n"
> "Get an attribute that would be inherited if the given (extension)\n"
> "class did not define it. This method is used when overriding\n"
> "inherited methods. It provides 2 advantages over accessing\n"
> "\n"
> "attributes directly through a superclass:\n"
> "\n"
> "1. The superclass need not be known,\n"
> "\n"
> "2. The superclass may be a Python class. Without this method, it
> would\n"
> " be possible to override methods inherited from python classes
> because\n"
> " unbound methods gotten from Python classes cannot be called with
> \n"
> " extension class instances. \n"
>
> Is there some documentation of this on zope.org or dev.zope.org that
> I've missed?
Probably not. This is documented in the ExtensionClass
documentation:
http://www.digicool.com/releases/ExtensionClass/
which is also included in the release at:
lib/Components/ExtensionClass/ExtensionClass.stx.
Jim
--
Jim Fulton mailto:jim@digicool.com
Technical Director (888) 344-4332 Python Powered!
Digital Creations http://www.digicool.com http://www.python.org
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission. Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.