On Tue, Aug 11, 2015 at 9:10 PM, Antony Lee <antony....@berkeley.edu> wrote:
> Compiling and running
>
> from libc cimport math
> def f():
>     print(math.abs(-1)) # oops, should be fabs
>
> results in NameError, name 'math' is not defined.  I guess that this results
> from the fact that cimported names and other names effectively live in
> different namespaces, but this is a bit confusing.

Agreed, this confusing.

We do want to support

    from libc cimport math
    import math

    math.somthing_that_only_exists_in_the_python_module()

I'm not sure we need to support

    from libc cimport math
    globals()['math'] = whatever
    math.somthing_that_only_exists_in_whatever

We've long wanted to restrict arbitrary writes to a Cython module's
global namespace... and of course such writes already aren't respected
by compile-time bindings, so is anyone opposed to making this an
error?

- Robert
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to