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.1 Arithmetic conversions

Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5. Expressions Up: 5. Expressions Next: 5.2 Atoms


5.1 Arithmetic conversions

When a description of an arithmetic operator below uses the phrase ``the numeric arguments are converted to a common type,'' the arguments are coerced using the coercion rules listed at the end of chapter 3. If both arguments are standard numeric types, the following coercions are applied:

  • If either argument is a complex number, the other is converted to complex;
  • otherwise, if either argument is a floating point number, the other is converted to floating point;
  • otherwise, if either argument is a long integer, the other is converted to long integer;
  • otherwise, both must be plain integers and no conversion is necessary.

Some additional rules apply for certain operators (e.g., a string left argument to the `%' operator). Extensions can define their own coercions.


Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5. Expressions Up: 5. Expressions Next: 5.2 Atoms

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.