[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-07 Thread Gregory Szorc
Gregory Szorc added the comment: Who uses this syntax? https://github.com/search?l=Python=%22from+.__init__+import%22=Code says a lot of random code, surprisingly/sadly. As for python-ideas, thanks for the suggestion: I may very well craft an email! --

[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-07 Thread Brett Cannon
Brett Cannon added the comment: You could propose your backwards-incompatible proposals on python-ideas, Greg, and see if you get any uptake. -- ___ Python tracker ___

[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the problem? What real code imports __init__? -- ___ Python tracker ___ ___

[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-04 Thread Gregory Szorc
Gregory Szorc added the comment: I worked around this in PyOxidizer by stripping a trailing `.__init__` from module names when resolving the indexed resource data. This allows the import to work since it can find the data now, but it also preserves the double module object, which isn't

[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-04 Thread Brett Cannon
Brett Cannon added the comment: I agree with Serhiy; don't do this. The only way we could fix this would be to always set a `__init__` module for every package implicitly, but then that would break anyone who wanted to clear out a package in sys.modules as the `__init__` reference in

[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Other example is: >>> import sys >>> import xml >>> import xml.__init__ >>> sys.modules['xml'] >>> sys.modules['xml.__init__'] >>> sys.modules['xml'] is sys.modules['xml.__init__'] False I'm not sure we should do anything about it other than say "Don't

[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-03 Thread Gregory Szorc
ariables not updating when you expect them to. (This could also be a feature for code relying on this behavior, of course.) I only attempted to reproduce with 3.9. But this behavior has likely existed for years. -- components: Interpreter Core messages: 382464 nosy: indygreg priority: norm

Re: import syntax

2013-07-31 Thread Chris Angelico
On Mon, Jul 29, 2013 at 11:37 PM, Joshua Landau jos...@landau.ws wrote: 2d) Realise that the slow part is not what you thought it was This step is mandatory. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: import syntax

2013-07-30 Thread Neil Cerutti
On 2013-07-29, Joshua Landau jos...@landau.ws wrote: Sure, just as one light is no brighter or dimmer than another when disregarding luminosity. As people have said, it improves diffs as well. It flows quicker into the from module import things form (which I oft prefer), too. When asking

import syntax

2013-07-29 Thread Devyn Collier Johnson
The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? Mahalo, Devyn Collier Johnson devyncjohn...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: import syntax

2013-07-29 Thread Joel Goldstick
On Mon, Jul 29, 2013 at 3:48 PM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? Mahalo, Devyn Collier Johnson

Re: import syntax

2013-07-29 Thread Dave Angel
On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? Pep 8 is not about performance, it's about readability. And unless the two

Re: import syntax

2013-07-29 Thread Tim Chase
On 2013-07-29 15:48, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re Why is that? Is there a performance advantage to one of the styles? While I don't believe there's much of a performance difference (if so, it

Re: import syntax

2013-07-29 Thread Tim Chase
On 2013-07-29 16:09, Dave Angel wrote: On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re I got a bit further, and if I'm only using a couple of functions from the import, I'll list them

Re: import syntax

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 04:20 PM, Tim Chase wrote: On 2013-07-29 16:09, Dave Angel wrote: On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this: import os, re I got a bit further, and if I'm only using a couple of functions

Re: import syntax

2013-07-29 Thread Joshua Landau
On 29 July 2013 21:23, Devyn Collier Johnson devyncjohn...@gmail.comwrote: On 07/29/2013 04:20 PM, Tim Chase wrote: On 2013-07-29 16:09, Dave Angel wrote: On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this:

Re: import syntax

2013-07-29 Thread Devyn Collier Johnson
On 07/29/2013 06:37 PM, Joshua Landau wrote: On 29 July 2013 21:23, Devyn Collier Johnson devyncjohn...@gmail.com mailto:devyncjohn...@gmail.com wrote: On 07/29/2013 04:20 PM, Tim Chase wrote: On 2013-07-29 16:09, Dave Angel wrote: On 07/29/2013 03:48 PM, Devyn