SCons.compat.builtins

Package SCons :: Package compat :: Module builtins |
[hide private]
[frames] | no frames]

# Module builtins

source code

Compatibility idioms for __builtin__ names

This module adds names to the __builtin__ module for things that we want to use in SCons but which don't show up until later Python versions than the earliest ones we support.

This module checks for the following __builtin__ names:

> all() any() bool() dict() True False zip()

Implementations of functions are NOT guaranteed to be fully compliant with these functions in later versions of Python. We are only concerned with adding functionality that we actually use in SCons, so be wary if you lift this code for other uses. (That said, making these more nearly the same as later, official versions is still a desirable goal, we just don't need to be obsessive about it.)

If you're looking at this with pydoc and various names don't show up in the FUNCTIONS or DATA output, that means those names are already built in to this version of Python and we don't need to add them from this module.

Functions | [hide private]
all(iterable) Returns True if all elements of the iterable are true. | source code
any(iterable) Returns True if any element of the iterable is true. | source code
bool(value) Demote a value to 0 or 1, depending on its truth value. | source code
dict(seq=[], **kwargs) New dictionary initialization. | source code
zip(*lists) Emulates the behavior we need from the built-in zip() function added in Python 2.2. | source code

Variables | [hide private]
| __doc__ = ``...``
| __revision__ = ``'``src/engine/SCons/compat/builtins.py 2725 2008/``...``
| False = `False`
| True = `True`

Function Details | [hide private]

### bool(value) | source code
Demote a value to 0 or 1, depending on its truth value. This is not to be confused with types.BooleanType, which is way too hard to duplicate in early Python versions to be worth the trouble.

### zip(*lists) | source code
Emulates the behavior we need from the built-in zip() function added in Python 2.2. Returns a list of tuples, where each tuple contains the i-th element rom each of the argument sequences. The returned list is truncated in length to the length of the shortest argument sequence.

Variables Details | [hide private]

  ### __doc__ Value:
      """
      Compatibility idioms for __builtin__ names

      This module adds names to the __builtin__ module for things that we wa
      nt
      to use in SCons but which don't show up until later Python versions th
      an
      the earliest ones we support.
      ...

  ### __revision__ Value:
      'src/engine/SCons/compat/builtins.py 2725 2008/03/31 12:52:02 knight'