[ZDP] Re: [Zope] ZClass

Martijn Faassen m.faassen@vet.uu.nl
Tue, 02 Nov 1999 17:53:28 +0100


Tom Deprez wrote:
> 
> At 11:08 02/11/1999 -0500, Michel Pelletier wrote:
> >Stephan Richter wrote:
> >>
> >> > Why does Zope asks for a value to enter for a new property when you're
> >> > making a class? I understand that you've to enter a value when you're
> >> > making a Class instance? But while defining a class??? Is this meant as a
> >> > default value??
> >> Okay, the problem is that Python does not know about data types. You cannot
> >> declare an"empty" (variable without value) variable in Python, since a
> >> statement like 'int test' does not exist.I have heard from DC (someone
> correct
> >> me please if I am wrong) that they tried to convind Guido to put variable
> >> declarations into the language without success.
> >
> >I can guarantee that's a rumor, the dynamic typing of Python is a good
> >thing.

I think the type checking that happens in the properties sheet does not
have much to do with Python's; it keeps its own list of the 'type' of a
property. 'int' properties cannot be left empty in Zope as the empty
string is not a valid integer. This is not a problem in the case of
normal properties, but it gets difficult with ZClass properties. In this
case the ZClass property value is the default of the ZClass instance
values, I think.

[goes off on tangent]
There is a movement to introduce type declarations to Python, though
it's currently quiet; it's the types-SIG at www.python.org. The idea is
to add *optional* static typing. There's also been some speculation on
interfaces (as they have in Java and Delphi for instance) in Python as a
related topic; last year Jim Fulton worked on a prototype for such a
system, I believe. Guido is of course doing his best to keep Python
within his vision of what is a good language and will therefore
scrutinize any optional static types or interfaces proposal or
implementation very carefully. Perhaps this is what caused the rumor. I
don't 
think Guido is against it, *if* someone can come up with a good enough
proposal. :)

All of this has I believe nothing to do with property sheets in Zope. :)
The whole interfaces idea would be interesting to have in Zope, though,
and static types might find their place in Zope if that makes the code
more maintainable and perhaps faster, but that's something for the far
future. Like when Python 2.0 is released (which is a deep future :).

Regards,

Martijn