Changeset 21


Ignore:
Timestamp:
05/13/06 16:32:29 (13 years ago)
Author:
sgk
Message:

sys.modules[name] = modにより、モジュール自体を入れ替えるようにした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • camellia/trunk/camellia.py

    r20 r21  
    3232''' 
    3333 
     34# 
     35# Try to import C version or Python version 
     36# 
    3437try: 
    35   from ccamellia import * 
     38  import ccamellia as mod 
    3639except: 
    37   from pycamellia import * 
     40  import pycamellia as mod 
     41 
     42# 
     43# Copy the __doc__ string above if the imported module doesn't have it. 
     44# 
     45import sys 
     46try: 
     47  if not mod.__doc__: 
     48    mod.__doc__ = __doc__ 
     49except: 
     50  setattr(mod, '__doc__', __doc__) 
     51 
     52# 
     53# Replace the module registration with the C or Python version. 
     54# 
     55sys.modules[__name__] = mod 
     56 
     57# 
     58# Delete unwanted variables. 
     59# 
     60del mod, sys 
Note: See TracChangeset for help on using the changeset viewer.