RE: [Zope] Boolean properties ( Zope 2.5)
In Python, 'and' and 'or' perform boolean logic as you would expect, but they do not return boolean values; they return one of the actual values they are comparing.
'a' and 'b' 'b' '' and 'b' ''
'a' or 'b' 'a' '' or 'b' 'b'
http://diveintopython.org/apihelper_andor.html Well, I found it interesting... -----Original Message----- From: Brian Sullivan [mailto:brians@meetingbywire.com] Sent: Thursday, 5 September 2002 2:27 a.m. To: zope@zope.org Subject: [Zope] Boolean properties ( Zope 2.5) I a trying to figure out what values are stored in Boolean typed properties of a Zope object in order to display information in and retrieve and set information from form checkboxes. What values are actually set/returned in boolean properties? _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Correct, but that's only when doing a comparison. Python will perform a lazy comparison, returning either the first true value (in an "or" expr.), or the last true value in an "and" expr. In the case stated, it's not so much a question of logic as it is value representation. Honestly, I don't understand why you would ever want the actual *value* returned by a boolean expression, instead of it's state. What needs to be done probably is a re-examination of the problem at hand. Cheers, Eron On Wed, 2002-09-04 at 18:29, Chris Beaven wrote:
In Python, 'and' and 'or' perform boolean logic as you would expect, but they do not return boolean values; they return one of the actual values they are comparing.
'a' and 'b' 'b' '' and 'b' ''
'a' or 'b' 'a' '' or 'b' 'b'
http://diveintopython.org/apihelper_andor.html
Well, I found it interesting...
-----Original Message----- From: Brian Sullivan [mailto:brians@meetingbywire.com] Sent: Thursday, 5 September 2002 2:27 a.m. To: zope@zope.org Subject: [Zope] Boolean properties ( Zope 2.5)
I a trying to figure out what values are stored in Boolean typed properties of a Zope object in order to display information in and retrieve and set information from form checkboxes.
What values are actually set/returned in boolean properties?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) --- [This E-mail scanned for viruses by Declude Virus]
--- [This E-mail scanned for viruses by Declude Virus]
participants (2)
-
Chris Beaven -
Eron Lloyd