Package tdi :: Package c
[frames] | no frames]

Package c

source code

Modules implemented in C

The modules in this package implement (or reimplement) various functionality in C for reasons of performance or availability. The performance implementations are always re-implementations of accompanying python functions.

The standard way to import these modules is to use the load function. It catches ImportError and disabled C overrides via environment.

Copyright: Copyright 2006 - 2015 André Malo or his licensors, as applicable


Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author: André Malo

load(modname, env_override=None, tpl=None)
Module loading facade
source code
  DEFAULT_TPL = 'tdi.c._tdi_%s'
  __package__ = 'tdi.c'
Function Details

load(modname, env_override=None, tpl=None)

source code 
Module loading facade
  • modname (str) - Module name part (like util for tdi.c._tdi_util), see tpl
  • env_override (str) - Name of the environment variable, which can disable the c extension import if set to 1. If omitted or None, DEFAULT_ENV_OVERRIDE is applied.
  • tpl (str) - Template for the fully qualified module name. It has to contain one %s format specifier which takes the modname part. If omitted or None, DEFAULT_TPL is applied.
Returns: module
The requested module or None (either by env request or ImportError)

Variables Details