[Python-Dev] Recent experience with the _ast module

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 15 02:01:27 CET 2007


Martin v. Löwis wrote:

>         switch(o) {
>                 case And:
>                         Py_INCREF(And_singleton);
>                         return And_singleton;
>                 case Or:
>                         Py_INCREF(Or_singleton);
>                         return Or_singleton;

Well, And_singleton and Or_singleton could be anything,
including integers or interned strings. Creating a
class and then a singleton instance for each one seems
like overkill and unnecessary bloat to me.

--
Greg


More information about the Python-Dev mailing list