<p dir="auto">Moving away from it would be a PITA since it is used a bunch, but this pattern makes it difficult for newcomers to see where things are defined.</p>
<p dir="auto">An idea for <code class="notranslate">numpy/__init__.py</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if sys.version_info[:2] &gt;= (3, 7):
    __all__ += ['__don_t_do_this']

    def __getattr__(attr):
        if attr == '__don_t_do_this':
            warning.warn(&quot;Don't do this')
            return None
        raise AttributeError"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-s1">sys</span>.<span class="pl-s1">version_info</span>[:<span class="pl-c1">2</span>] <span class="pl-c1">&gt;=</span> (<span class="pl-c1">3</span>, <span class="pl-c1">7</span>):
    <span class="pl-s1">__all__</span> <span class="pl-c1">+=</span> [<span class="pl-s">'__don_t_do_this'</span>]

    <span class="pl-k">def</span> <span class="pl-en">__getattr__</span>(<span class="pl-s1">attr</span>):
        <span class="pl-k">if</span> <span class="pl-s1">attr</span> <span class="pl-c1">==</span> <span class="pl-s">'__don_t_do_this'</span>:
            <span class="pl-s1">warning</span>.<span class="pl-en">warn</span>("<span class="pl-v">Don</span><span class="pl-s">'t do this'</span>)
            <span class="pl-k">return</span> <span class="pl-c1">None</span>
        <span class="pl-k">raise</span> <span class="pl-v">AttributeError</span></pre></div>