ra = (dir, 0, 2000)
while 1:
(status, rest) = self.Readdir(ra)
- if status <> NFS_OK:
+ if status != NFS_OK:
break
entries, eof = rest
last_cookie = None
self.pack_uint(0)
def pack_farray(self, n, list, pack_item):
- if len(list) <> n:
+ if len(list) != n:
raise ValueError, 'wrong array size'
for item in list:
pack_item(item)
while 1:
x = self.unpack_uint()
if x == 0: break
- if x <> 1:
+ if x != 1:
raise RuntimeError, '0 or 1 expected, got %r' % (x, )
item = unpack_item()
list.append(item)
ubytes = ubytes + bytes
users[user] = ujobs, ubytes
else:
- if fields and fields[0] <> 'Rank':
+ if fields and fields[0] != 'Rank':
line = string.strip(line)
if line == 'no entries':
line = name + ': idle'
#
if totaljobs:
line = '%d K' % ((totalbytes+1023)/1024)
- if totaljobs <> len(users):
+ if totaljobs != len(users):
line = line + ' (%d jobs)' % totaljobs
if len(users) == 1:
line = line + ' for %s' % (users.keys()[0],)
while i <= max:
for p in primes:
if i%p == 0 or p*p > i: break
- if i%p <> 0:
+ if i%p != 0:
primes.append(i)
if i >= min: print i
i = i+2
print 'Funny line:', line,
continue
filename, lineno = prog.group(1, 2)
- if not curfile or filename <> curfile.filename:
+ if not curfile or filename != curfile.filename:
if curfile: curfile.finish()
curfile = FileObj(filename)
curfile.process(lineno, line[n:])
def browse_telnet(selector, host, port):
if selector:
print 'Log in as', repr(selector)
- if type(port) <> type(''):
+ if type(port) != type(''):
port = repr(port)
sts = os.system('set -x; exec telnet ' + host + ' ' + port)
if sts:
os.close(i)
except os.error:
pass
- if os.dup(p2cread) <> 0:
+ if os.dup(p2cread) != 0:
sys.stderr.write('popen2: bad read dup\n')
- if os.dup(c2pwrite) <> 1:
+ if os.dup(c2pwrite) != 1:
sys.stderr.write('popen2: bad write dup\n')
- if os.dup(c2pwrite) <> 2:
+ if os.dup(c2pwrite) != 2:
sys.stderr.write('popen2: bad write dup\n')
for i in range(3, MAXFD):
try:
os.mkdir(opts.directory)
except OSError, e:
# Ignore directory exists error
- if e.errno <> errno.EEXIST:
+ if e.errno != errno.EEXIST:
raise
fp = open(msgfile)
\lineiii{>}{strictly greater than}{}
\lineiii{>=}{greater than or equal}{}
\lineiii{==}{equal}{}
- \lineiii{!=}{not equal}{(1)}
- \lineiii{<>}{not equal}{(1)}
+ \lineiii{!=}{not equal}
\lineiii{is}{object identity}{}
\lineiii{is not}{negated object identity}{}
\end{tableiii}
\opindex{is}
\opindex{is not}
-\noindent
-Notes:
-
-\begin{description}
-
-\item[(1)]
-\code{<>} and \code{!=} are alternate spellings for the same operator.
-\code{!=} is the preferred spelling; \code{<>} is obsolescent.
-
-\end{description}
-
Objects of different types, except different numeric types and different string types, never
compare equal; such objects are ordered consistently but arbitrarily
(so that sorting a heterogeneous array yields a consistent result).
Hint: the following code tests whether you are on a machine that
supports more than two colors:
\begin{verbatim}
-if stdwin.fetchcolor('black') <> \
- stdwin.fetchcolor('red') <> \
+if stdwin.fetchcolor('black') != \
+ stdwin.fetchcolor('red') != \
stdwin.fetchcolor('white'):
print 'color machine'
else:
\begin{verbatim}
+ - * ** / // %
<< >> & | ^ ~
-< > <= >= == != <>
+< > <= >= == !=
\end{verbatim}
-The comparison operators \code{<>} and \code{!=} are alternate
-spellings of the same operator. \code{!=} is the preferred spelling;
-\code{<>} is obsolescent.
-
\section{Delimiters\label{delimiters}}
\code{\var{x}<\var{y}} calls \code{\var{x}.__lt__(\var{y})},
\code{\var{x}<=\var{y}} calls \code{\var{x}.__le__(\var{y})},
\code{\var{x}==\var{y}} calls \code{\var{x}.__eq__(\var{y})},
-\code{\var{x}!=\var{y}} and \code{\var{x}<>\var{y}} call
-\code{\var{x}.__ne__(\var{y})},
+\code{\var{x}!=\var{y}} calls \code{\var{x}.__ne__(\var{y})},
\code{\var{x}>\var{y}} calls \code{\var{x}.__gt__(\var{y})}, and
\code{\var{x}>=\var{y}} calls \code{\var{x}.__ge__(\var{y})}.
These methods can return any value, but if the comparison operator is
\production{comparison}
{\token{or_expr} ( \token{comp_operator} \token{or_expr} )*}
\production{comp_operator}
- {"<" | ">" | "==" | ">=" | "<=" | "<>" | "!="}
+ {"<" | ">" | "==" | ">=" | "<=" | "!="}
\productioncont{| "is" ["not"] | ["not"] "in"}
\end{productionlist}
between \var{a} and \var{c}, so that, e.g., \code{x < y > z} is
perfectly legal (though perhaps not pretty).
-The forms \code{<>} and \code{!=} are equivalent; for consistency with
-C, \code{!=} is preferred; where \code{!=} is mentioned below
-\code{<>} is also accepted. The \code{<>} spelling is considered
-obsolescent.
-
The operators \code{<}, \code{>}, \code{==}, \code{>=}, \code{<=}, and
\code{!=} compare
the values of two objects. The objects need not have the same type.
\lineii{\keyword{in}, \keyword{not} \keyword{in}}{Membership tests}
\lineii{\keyword{is}, \keyword{is not}}{Identity tests}
\lineii{\code{<}, \code{<=}, \code{>}, \code{>=},
- \code{<>}, \code{!=}, \code{==}}
+ \code{!=}, \code{==}}
{Comparisons}
\hline
\lineii{\code{|}} {Bitwise OR}
x^y Bitwise exclusive or
x|y Bitwise or
x<y x<=y x>y x>=y x==y x!=y Comparison,
- x<>y identity,
x is y x is not y membership
x in s x not in s
not x boolean negation
> strictly greater than
>= greater than or equal to
== equal to
-!= or <> not equal to
+!= not equal to
is object identity (2)
is not negated object identity (2)
an error in initialization, mustimport it one more time
before calling reload().
Returns a string containing a printable and if possible
-repr(object) evaluable representation of an object. <=> `object`
- (usingbackquotes). Class redefinissable (__repr__). See
- also str()
+repr(object) evaluable representation of an object.
+ Class redefinable (__repr__). See also str().
round(x, n=0) Returns the floating point value x rounded to n digitsafter
the decimal point.
setattr(object, This is the counterpart of getattr().setattr(o, 'foobar',
;; Both single quote and double quote are string delimiters
(modify-syntax-entry ?\' "\"" py-mode-syntax-table)
(modify-syntax-entry ?\" "\"" py-mode-syntax-table)
- ;; backquote is open and close paren
- (modify-syntax-entry ?\` "$" py-mode-syntax-table)
;; comment delimiters
(modify-syntax-entry ?\# "<" py-mode-syntax-table)
(modify-syntax-entry ?\n ">" py-mode-syntax-table)
/* Give up */
PyErr_Format(PyExc_TypeError,
- "unorderable types: '%.100s' <> '%.100s'",
+ "unorderable types: '%.100s' != '%.100s'",
v->ob_type->tp_name,
w->ob_type->tp_name);
return -1;