[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/lib/python/Zope/TextIndex - TextIndexInterfaces.py:1.3 TextIndexWrapper.py:1.3

Guido van Rossum guido@python.org
Wed, 04 Dec 2002 14:25:48 -0500


> +class IStatistics(Interface):
> +
> +    def documentCount():
> +        """Return the number of documents currently indexed."""
> +
> +    def wordCount():
> +        """Return the number of words currently indexed."""
> 
> Hey.  I assume documentCount is a part of the same interface as
> wordCount because TextIndex goes in the Zope directory and all the other
> index stuff goes in the App/index directory (lower in the tree), but...
> 
> FWIW, documentCount does seem like a more generically useful statistic
> for an index than wordCount, and it seems like it might be nice to
> factor out.  Somewhere.  ;-)

I guess we'll refactor this once we have other index types.

> Also, you're the best person to answer this in the universe, I imagine,
> so out of curiosity, why aren't these attributes in the interface and
> implemented as Python 2.2 properties?

Partly historic, partly because I didn't think about it, but now that
I *do* think about it, I think it's right they are methods: they can do
some non-trivial computation (calculating the size of a persistent
BTree requires faulting in the buckets).

--Guido van Rossum (home page: http://www.python.org/~guido/)