GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — 5.5 Unary arithmetic operations

Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5.4 The power operator Up: 5. Expressions Next: 5.6 Binary arithmetic operations


5.5 Unary arithmetic operations

All unary arithmetic (and bit-wise) operations have the same priority:

u_expr:         power | "-" u_expr | "+" u_expr | "~" u_expr

The unary - (minus) operator yields the negation of its numeric argument.

The unary + (plus) operator yields its numeric argument unchanged.

The unary ~ (invert) operator yields the bit-wise inversion of its plain or long integer argument. The bit-wise inversion of x is defined as -(x+1). It only applies to integral numbers.

In all three cases, if the argument does not have the proper type, a TypeError exception is raised.


Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5.4 The power operator Up: 5. Expressions Next: 5.6 Binary arithmetic operations

See About this document... for information on suggesting changes.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.