Hi, Just a little question: Yesterday, I was working with ZClasses. While making one of my own, I saw that Zope asked for a value to enter per property. 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?? This is particulary strange when working with a propery as date. What to do, if you don't want to give a default value? Zope always complains that you have to give a value. Please, help to clear my mind Tom.
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. You do not need to supply a default value for strings and text, since it usually uses "" to do that. I usually put 0 for the integers and floats. I know that is very annoying, but has to that way. But about Dates. Hmm, Zope uses an early (completely GPL) version of DateTime. I thought you can create a DateTime object without a default value. Strange.
Tom, I hope that helped. cheers, stephan -- Stephan Richter iXL - Software Designer and Engineer CBU - Physics, Computer Science and Chemistry Student
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. -Michel
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.
-Michel
Ok, this has to be included in ZBook. Dody, can you include a part of this in the Phyton section Dody or Rik, can this also be included in the DTML section? Thanks all, Tom.
I had the same problem. See thread 'Can't add "date" property to new ZClass' from 1999-10-11. Here is Michel's response: """ [Zope] should be a little smarter than that. In fact, it should be smarter for instances also and just assume a sane value (like calling DateTime() with no arguments, which returns 'now'). Please submit to the Collector. Should be a pretty trivial fix if you want to take a hack at it and submit a patch, just sniff for a null value and insert DateTime() instead of DateTime(formvalue). -Michel """ I didn't patch it; I submitted to Collector. -- Loren
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Tom Deprez Sent: Tuesday, November 02, 1999 05:08 To: zope@zope.org Subject: [Zope] ZClass
Hi,
Just a little question:
Yesterday, I was working with ZClasses. While making one of my own, I saw that Zope asked for a value to enter per property.
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??
This is particulary strange when working with a propery as date. What to do, if you don't want to give a default value? Zope always complains that you have to give a value.
Please, help to clear my mind
Tom.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope
(Related lists - please, no cross posts or HTML encoding!
To receive general Zope announcements, see: http://lists.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://lists.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Loren Stafford -
Michel Pelletier -
Stephan Richter -
Tom Deprez