Re: an Interface expressing "a list of generator function"

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On Tue, Nov 9, 2010 at 2:58 AM, Jean-Daniel <[email protected]> wrote:
> Ok,
> If I attach an item_type to the the list, I do not think I will able to use
> the native Python list, and should use a subclass instead. It is a bit
> heavyweight, especially when the intent of the use of the interface was
> documentation.

Tres could have avoided the generalization and just said something like:

class IGeneratorList(Interface):
    "A sequence of generators."

    def __getitem__(index):
        """ Return the 'index'th item.

        'index' must be an integer between 0 and __len__() - 1,
        else raise IndexError.
        """

blah blah...

Note that zope interfaces are only *semi*-formal.

> List and generators are very common in Python and are expressed in very few
> and clear characters,

Huh? What does this mean?

> I thought there would be a shorter  way to document
> their interfaces.

What exactly are you hoping to accomplish?

Jim

--
Jim Fulton
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.