[Python-ideas] ImportError raised for a circular import

Stephan Houben stephanh42 at gmail.com
Wed Jun 14 06:16:14 EDT 2017


Huh? The semantics of node.js seem to be completely similar to Python in
this respect.

In both cases the circular import works if you go through the mutable
module object but fails if both modules circularly try to import module
members directly.

Stephan

Op 14 jun. 2017 11:17 a.m. schreef "Abdur-Rahmaan Janhangeer" <
arj.python at gmail.com>:

> anyways circular imports seem to be making people go for node.js rather
> than using python . . .
>
> Abdur-Rahmaan Janhangeer,
> Mauritius
> abdurrahmaanjanhangeer.wordpress.com
>
> On 13 Jun 2017 23:04, "Barry Scott" <barry at barrys-emacs.org> wrote:
>
>> Recently I fell into the trap of creating a circular import and yet again
>> it took time to figure out what was wrong.
>>
>> I'm wondering why the python import code does not detect this error and
>> raise an exception.
>>
>> I took a look at the code and got as far as figuring out that I would
>> need to add the detection to the
>> python 3 import code. Unless I missed something I cannot get the
>> detection without
>> modifying the core code as I could see no way to hook the process cleanly.
>>
>> Is it reasonable idea to add this detection to python?
>>
>> I am willing to work on a patch.
>>
>> Barry
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170614/ae5af863/attachment-0001.html>


More information about the Python-ideas mailing list