homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients amaury.forgeotdarc, belopolsky, brett.cannon, brian.curtin, daniel.urban, lemburg, pitrou, r.david.murray, techtonik, vstinner
Date 2010年06月17日.15:03:31
SpamBayes Score 0.00017820689
Marked as misclassified No
Message-id <4C1A3941.2080100@egenix.com>
In-reply-to <1276786156.3.0.931625302259.issue7989@psf.upfronthosting.co.za>
Content
Alexander Belopolsky wrote:
> 
> Alexander Belopolsky <belopolsky@users.sourceforge.net> added the comment:
> 
>> To avoid the wasted memory and import time, it's better to use:
>>
>> try:
>> from _cmodule import *
>> except ImportError:
>> from _pymodule import *
>>
> 
> .. also this makes it harder to prototype things in Python or have mixed Python/C modules. The goal is to use Python implementation unless native implementation exists on per function/class basis. The syntax above makes it all or nothing.
Why ?
You can have the Python parts that are used by both implementation
defined in the datetime.py module.
Alternatively, you could write:
try:
 # Use the faster C version
 from _module import *
except ImportError:
 # Use Python
 class datetime:
 ...
I find that rather ugly, though.
History
Date User Action Args
2010年06月17日 15:03:33lemburgsetrecipients: + lemburg, brett.cannon, amaury.forgeotdarc, belopolsky, pitrou, vstinner, techtonik, r.david.murray, brian.curtin, daniel.urban
2010年06月17日 15:03:31lemburglinkissue7989 messages
2010年06月17日 15:03:31lemburgcreate

AltStyle によって変換されたページ (->オリジナル) /