From: Stephan Richter <srichter@cbu.edu> To: Tom Deprez <tom.deprez@uz.kuleuven.ac.be>; zope@zope.org <zope@zope.org>
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 [snip]
Sure you can declare an empty variable in Python, and you can test for it. Of course you can't test for its data type, but so what - it can become any data type you need. Run the intrepreter and try this:
aa Traceback (innermost last): File "<stdin>", line 1, in ? NameError: aa
# aa was not declared so it does not exist.
ob=None ob # ob was declared as an empty object (that's what None is: a standard empty object) and gives no error when referred to.
ob==None 1
# The statement ob==None is true
aa==None Traceback (innermost last): File "<stdin>", line 1, in ? NameError: aa # The statement aa==None is an error since aa has not been created.
Finally, create this script as ob.py and run it: try: aa==None except: print "aa hasn't been defined" Run it: C:>python ob aa hasn't been defined So in Python you CAN define an empty variable and check for its existence, but whether or not that is a useful or even possible thing to do in Zope is another matter. Tom Passin
participants (1)
-
Thomas B. Passin