Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / boolean.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="comparisons.html" />
13<link rel="prev" href="truth.html" />
14<link rel="parent" href="types.html" />
15<link rel="next" href="comparisons.html" />
16<meta name='aesop' content='information' />
17<title>2.3.2 Boolean Operations -- and, or, not </title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="2.3.1 Truth Value Testing"
25 href="truth.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="2.3 Built-in Types"
28 href="types.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="2.3.3 Comparisons"
31 href="comparisons.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="truth.html">2.3.1 Truth Value Testing</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="types.html">2.3 Built-in Types</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="comparisons.html">2.3.3 Comparisons</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION004320000000000000000"></A><A NAME="boolean"></A>
56<BR>
572.3.2 Boolean Operations --
58 <tt class="keyword">and</tt>, <tt class="keyword">or</tt>, <tt class="keyword">not</tt>
59
60</H2>
61
62<P>
63These are the Boolean operations, ordered by ascending priority:
64<a id='l2h-104' xml:id='l2h-104'></a>
65<P>
66<div class="center"><table class="realtable">
67 <thead>
68 <tr>
69 <th class="center">Operation</th>
70 <th class="left" >Result</th>
71 <th class="center">Notes</th>
72 </tr>
73 </thead>
74 <tbody>
75 <tr><td class="center" valign="baseline"><code><var>x</var> or <var>y</var></code></td>
76 <td class="left" >if <var>x</var> is false, then <var>y</var>, else <var>x</var></td>
77 <td class="center">(1)</td></tr>
78 <tr><td class="center" valign="baseline"><code><var>x</var> and <var>y</var></code></td>
79 <td class="left" >if <var>x</var> is false, then <var>x</var>, else <var>y</var></td>
80 <td class="center">(1)</td></tr>
81
82 <tr><td class="center" valign="baseline"><code>not <var>x</var></code></td>
83 <td class="left" >if <var>x</var> is false, then <code>True</code>, else <code>False</code></td>
84 <td class="center">(2)</td></tr></tbody>
85</table></div>
86<a id='l2h-105' xml:id='l2h-105'></a><a id='l2h-106' xml:id='l2h-106'></a><a id='l2h-107' xml:id='l2h-107'></a>
87<P>
88Notes:
89
90<P>
91<DL>
92<DT><STRONG>(1)</STRONG></DT>
93<DD>These only evaluate their second argument if needed for their outcome.
94
95<P>
96</DD>
97<DT><STRONG>(2)</STRONG></DT>
98<DD>"<tt class="samp">not</tt>" has a lower priority than non-Boolean operators, so
99<code>not <var>a</var> == <var>b</var></code> is interpreted as <code>not (<var>a</var> ==
100<var>b</var>)</code>, and <code><var>a</var> == not <var>b</var></code> is a syntax error.
101
102<P>
103</DD>
104</DL>
105
106<P>
107
108<DIV CLASS="navigation">
109<div class='online-navigation'>
110<p></p><hr />
111<table align="center" width="100%" cellpadding="0" cellspacing="2">
112<tr>
113<td class='online-navigation'><a rel="prev" title="2.3.1 Truth Value Testing"
114 href="truth.html"><img src='../icons/previous.png'
115 border='0' height='32' alt='Previous Page' width='32' /></A></td>
116<td class='online-navigation'><a rel="parent" title="2.3 Built-in Types"
117 href="types.html"><img src='../icons/up.png'
118 border='0' height='32' alt='Up One Level' width='32' /></A></td>
119<td class='online-navigation'><a rel="next" title="2.3.3 Comparisons"
120 href="comparisons.html"><img src='../icons/next.png'
121 border='0' height='32' alt='Next Page' width='32' /></A></td>
122<td align="center" width="100%">Python Library Reference</td>
123<td class='online-navigation'><a rel="contents" title="Table of Contents"
124 href="contents.html"><img src='../icons/contents.png'
125 border='0' height='32' alt='Contents' width='32' /></A></td>
126<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
127 border='0' height='32' alt='Module Index' width='32' /></a></td>
128<td class='online-navigation'><a rel="index" title="Index"
129 href="genindex.html"><img src='../icons/index.png'
130 border='0' height='32' alt='Index' width='32' /></A></td>
131</tr></table>
132<div class='online-navigation'>
133<b class="navlabel">Previous:</b>
134<a class="sectref" rel="prev" href="truth.html">2.3.1 Truth Value Testing</A>
135<b class="navlabel">Up:</b>
136<a class="sectref" rel="parent" href="types.html">2.3 Built-in Types</A>
137<b class="navlabel">Next:</b>
138<a class="sectref" rel="next" href="comparisons.html">2.3.3 Comparisons</A>
139</div>
140</div>
141<hr />
142<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
143</DIV>
144<!--End of Navigation Panel-->
145<ADDRESS>
146See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
147</ADDRESS>
148</BODY>
149</HTML>