Serhiy Storchaka added the comment:

Here is a patch using enums. I still think enums are superfluous here. Advanced 
the Enum class features (pickling, access by name, type checking) are not 
needed - these constants don't leaked in outer word.

> I don't see where there would be a circular dependency; the enum module
> doesn't import the re module.

Right now there is no circular dependency. But the enum module imports 
collections which imports a lot of other modules, some of which import other 
modules. In future some of indirectly imported module can import the re module.

> There is one thing that might be less convenient: defining an enum doesn't
> automatically make the values globals. But wouldn't the code be better if
> the values weren't globals?

I afraid this will make the code of parser and compiler less readable and 
slower. In any case the sre_constants module itself is a namespace.

----------
Added file: http://bugs.python.org/file36657/re_opcode_enums.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22434>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to