Amaury Forgeot d Arc <[email protected]> added the comment:

I write my cffi helper modules like this:

xmllib.py::

    ...cffi declarations...
    ffilib = ffi.verify(...)

    for name in dir(ffilib):
        # Export all public declared names
        if name.startswith(('xml', 'xslt')):
            globals()[name] = getattr(ffilib, name)

Then you can simply access functions and defines with code like::
    import xmllib
    xmllib.XML_TEXT_NODE
This used to work with variables.

Of course, the workaround is to do::
    xsltDocDefaultLoader = mylib.xsltDocDefaultLoader
but for each variable.


[Now, I realize that "mylib" is itself a Module... maybe there is nice a 
pattern which hacks sys.modules.]

________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1476>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to