[Python-Dev] How to interpret get_code from PEP 302?

Nick Coghlan ncoghlan at gmail.com
Wed Aug 22 12:28:50 CEST 2007


Greg Ewing wrote:
> Paul Moore wrote:
>> What the sentence you quote
>> is trying to say is that if there's a need to compile source, the
>> get_code method must do this on behalf of the caller - it can't return
>> None and expect the caller to try get_source and compile it manually.
> 
> Why not simply say that it must return a code object?
> All the rest follows from that.

The method is allowed to return None if a code object genuinely isn't 
available (which happens when the module is a builtin or extension module).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list