On Fri, Apr 3, 2009 at 1:55 PM, Gary Poster <gary.pos...@gmail.com> wrote:

> How would that be a win for you (or anybody else) over just putting the
> constant in the interfaces module?

Standard practice seems to favor putting several interfaces in a single
"interfaces" module, so just putting the constants in the module doesn't
make it explicit that these constants go with a particular interface.
Putting them on the interface itself makes the relationship plain.

> If it is in the interface, that implies we need to "implement" it
> someplace--the constant will be defined in the interface and in the
> implementation?  Or we would offer automation to copy the values over from
> the interface to objects that implement the interface?

Thanks for bringing that up.  I hadn't considered that.  In languages with
built-in interface support, classes generally inherent constants from the
interface, so automatically copying the values over would seem to make
sense.  Although it's also considered best practice in those languages to
refer to the constants by their interface anyway, so one could argue that
such a step could be omitted.  Zope's implementation of interfaces is unique
among implementations I know about, in allowing programmers to mark live
objects with an interface, which would introduce an interesting edge case
with regards to copying constants over.  I'd say if the implementation gets
too polluted with edge cases, it's probably not worth it.

>  Using descriptors, the results could be both static and immutable.
> Mostly static and immutable, anyway. :-)  In Python, there's almost always
> a way around absolutes like that unless you are working with something in
> which the constraint has been coded in C.

Right, but since we have descriptors, why not use them?  Maybe I should have
used the Colbertian "immutablish".

I don't have my heart set on this.  I found a use case today and was just
thinking about ways to satisfy it.

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to