/Doc/library/constants.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 73 lines · 43 code · 30 blank · 0 comment · 0 complexity · bbb88d08552633fd8a52a039388a3cfe MD5 · raw file

  1. Built-in Constants
  2. ==================
  3. A small number of constants live in the built-in namespace. They are:
  4. .. data:: False
  5. The false value of the :class:`bool` type.
  6. .. versionadded:: 2.3
  7. .. data:: True
  8. The true value of the :class:`bool` type.
  9. .. versionadded:: 2.3
  10. .. data:: None
  11. The sole value of :attr:`types.NoneType`. ``None`` is frequently used to
  12. represent the absence of a value, as when default arguments are not passed to a
  13. function.
  14. .. versionchanged:: 2.4
  15. Assignments to ``None`` are illegal and raise a :exc:`SyntaxError`.
  16. .. data:: NotImplemented
  17. Special value which can be returned by the "rich comparison" special methods
  18. (:meth:`__eq__`, :meth:`__lt__`, and friends), to indicate that the comparison
  19. is not implemented with respect to the other type.
  20. .. data:: Ellipsis
  21. Special value used in conjunction with extended slicing syntax.
  22. .. XXX Someone who understands extended slicing should fill in here.
  23. .. data:: __debug__
  24. This constant is true if Python was not started with an :option:`-O` option.
  25. Assignments to :const:`__debug__` are illegal and raise a :exc:`SyntaxError`.
  26. See also the :keyword:`assert` statement.
  27. Constants added by the :mod:`site` module
  28. -----------------------------------------
  29. The :mod:`site` module (which is imported automatically during startup, except
  30. if the :option:`-S` command-line option is given) adds several constants to the
  31. built-in namespace. They are useful for the interactive interpreter shell and
  32. should not be used in programs.
  33. .. data:: quit([code=None])
  34. exit([code=None])
  35. Objects that when printed, print a message like "Use quit() or Ctrl-D
  36. (i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the
  37. specified exit code, and when .
  38. .. data:: copyright
  39. license
  40. credits
  41. Objects that when printed, print a message like "Type license() to see the
  42. full license text", and when called, display the corresponding text in a
  43. pager-like fashion (one screen at a time).