home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / b / boolean_op < prev    next >
Text File  |  1996-11-14  |  1KB  |  25 lines

  1. <TITLE>Boolean Operations -- Python library reference</TITLE>
  2. Next: <A HREF="../c/comparisons" TYPE="Next">Comparisons</A>  
  3. Prev: <A HREF="../t/truth_value_testing" TYPE="Prev">Truth Value Testing</A>  
  4. Up: <A HREF="../t/types" TYPE="Up">Types</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H2>2.1.2. Boolean Operations</H2>
  7. These are the Boolean operations, ordered by ascending priority:
  8. <DL>
  9. <DT><I>Operation</I><DD><I>Result</I>  ---  <I>Notes</I>
  10. <P>
  11. <DT><CODE><VAR>x</VAR> or <VAR>y</VAR></CODE><DD>if <VAR>x</VAR> is false, then <VAR>y</VAR>, else <VAR>x</VAR>  ---  (1)
  12. <DT><CODE><VAR>x</VAR> and <VAR>y</VAR></CODE><DD>if <VAR>x</VAR> is false, then <VAR>x</VAR>, else <VAR>y</VAR>  ---  (1)
  13. <DT><CODE>not <VAR>x</VAR></CODE><DD>if <VAR>x</VAR> is false, then <CODE>1</CODE>, else <CODE>0</CODE>  ---  (2)
  14. </DL>
  15.  Notes:
  16. <P>
  17. <DL>
  18. <DT><B>(1)</B><DD>These only evaluate their second argument if needed for their outcome.
  19. <P>
  20. <DT><B>(2)</B><DD>`<SAMP>not</SAMP>' has a lower priority than non-Boolean operators, so e.g.
  21. <CODE>not a == b</CODE> is interpreted as <CODE>not(a == b)</CODE>, and
  22. <CODE>a == not b</CODE> is a syntax error.
  23. <P>
  24. </DL>
  25.