[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-dev
Subject:    [Python-Dev] Re: import * and __future__ imports
From:       Guido van Rossum <guido () python ! org>
Date:       2022-03-28 15:56:02
Message-ID: CAP7+vJLGVaxj-D9h1hyM0SZFJs3+ARkfBqfDUV+6bqT88FyGYQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Mon, Mar 28, 2022 at 8:52 AM Irit Katriel <iritkatriel@googlemail.com>
wrote:

>
>
> On Mon, Mar 28, 2022 at 4:44 PM Guido van Rossum <guido@python.org> wrote:
>
>>
>> "Future" imports are special to the parser, and they may also set a flag
>> for the runtime to alter its behavior, but they are intentionally not
>> treated specially by code generation, so they are still properly imported.
>> However the presence of the imported thing is not used by the runtime to
>> determine its behavior; those flags are stored elsewhere guided by the code
>> generator.
>>
>
> Right, this is why it's confusing when the object is there for no reason
> (the future import did not have any impact on the module, but the object
> showed up via an import *).
>

As Petr said, it's no more confusing than any other imported thing showing
up as a global.


> I don't think there's anything to do here.
>>
>
> How about the suggestion in https://bugs.python.org/issue26120 ? It's
> about these objects showing up in pydoc (both when the __future__ had an
> impact and when it didn't - in either case it's not an interesting part of
> the module's API).
>

If pydoc wants to filter that's up to pydoc (I'm not maintaining that).
Though really this should be keyed off `__all__`.


-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar \
28, 2022 at 8:52 AM Irit Katriel &lt;<a \
href="mailto:iritkatriel@googlemail.com">iritkatriel@googlemail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
dir="ltr"><br><div><br></div><div>On Mon, Mar 28, 2022 at 4:44 PM Guido van Rossum \
&lt;<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>&gt; \
wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
class="gmail_quote"><div><br></div><div>&quot;Future&quot; imports are special to the \
parser, and they may also set a flag for the runtime to alter its behavior, but they \
are intentionally not treated specially by code generation, so they are still \
properly imported. However the presence of the imported thing is not used by the \
runtime to determine its behavior; those flags are stored elsewhere guided by the \
code generator.</div></div></div></blockquote><div><br></div><div>Right, this is why \
it&#39;s confusing when the object is there for no reason (the future import did not \
have any impact on the module, but the object showed up via an import \
*).</div></div></div></blockquote><div><br></div><div>As Petr said, it&#39;s no more \
confusing than any other imported thing showing up as a global. <br></div><div>   \
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
class="gmail_quote"><div>I don&#39;t think there&#39;s anything to do \
here.</div></div></div></blockquote><div><br></div><div class="gmail_quote">How about \
the suggestion in  <a href="https://bugs.python.org/issue26120" rel="nofollow" \
style="font-size:13px;font-family:&quot;Helvetica \
Neue&quot;,Helvetica,Arial,sans-serif" \
target="_blank">https://bugs.python.org/issue26120</a>  ? It&#39;s about these \
objects showing up in pydoc (both when the __future__ had an impact and when it \
didn&#39;t - in either case it&#39;s not an interesting part of the module&#39;s \
API).</div></div></div></blockquote><div><br></div><div>If pydoc wants to filter \
that&#39;s up to pydoc (I&#39;m not maintaining that). Though really this should be \
keyed off `__all__`. <br></div></div><br clear="all"><br>-- <br><div dir="ltr" \
class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>--Guido van Rossum \
(<a href="http://python.org/~guido" \
target="_blank">python.org/~guido</a>)</div><div><i \
style="font-family:Arial,Helvetica,sans-serif;font-size:small;font-weight:400;letter-s \
pacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal; \
word-spacing:0px;background-color:rgb(255,255,255);color:rgb(136,136,136)"><span>Pronouns</span>: \
he/him </i><a href="http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/" \
style="color:rgb(17,85,204);font-family:Arial,Helvetica,sans-serif;font-size:small;fon \
t-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px; \
text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)" \
target="_blank"><i>(why is my  <span>pronoun</span>  \
here?)</i></a></div></div></div></div></div></div>



_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/UPFIY4DCIELDR6M5KAWLCRCKGG7G5MWM/
 Code of Conduct: http://python.org/psf/codeofconduct/



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic