[Python-3000] PEP 3100 Comments

Georg Brandl g.brandl at gmx.net
Sun May 7 15:04:54 CEST 2006


Greg Ewing wrote:
> Talin wrote:
> 
>> (Admittedly this particular case could be done without 'callable', since you
>> could test for string type, and assume callable otherwise.
> 
> Yes, and that's exactly why it can be made to work
> in this particular case. Most likely no testing for
> callability is being done, only isinstance(repl, str).

Use the source, Luke:

     if (PyCallable_Check(ptemplate)) {
         /* sub/subn takes either a function or a template */
         filter = ptemplate;
         Py_INCREF(filter);
         filter_is_callable = 1;
  [...]


Georg



More information about the Python-3000 mailing list