A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20171115/2744d828/attachment.html below:

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 15 November 2017 at 08:43, Serhiy Storchaka <span dir="ltr"><<a href="mailto:storchaka@gmail.com" target="_blank">storchaka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">14.11.17 22:34, Ivan Levkivskyi Ð¿Ð¸ÑˆÐµ:<span class=""><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This function will be called only if ``name`` is not found in the module<br>
through the normal attribute lookup.<br>
</blockquote>
<br></span>
It is worth to mention that using name as a module global will bypass __getattr__. And this is intentional, otherwise calling __getattr__ for builtins will harm a performance.<span class=""><br>
<br></span></blockquote><div><br></div><div>Good point!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Backwards compatibility and impact on performance<br>
==============================<wbr>===================<br>
</blockquote>
<br></span>
What is affect on pydoc, word completion, inspect, pkgutil, unittest?<span class=""><br>
<br></span></blockquote><div><br></div><div>This is rather gray area. I am not sure that we need to update them in any way, just the people who use __getattr__ should be aware that</div><div>some tools might not yet expect it. I will add a note to the PEP about this.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   def keep_pickleable(func):<br>
   Â  Â  func.__name__ = func.__name__.replace('_deprec<wbr>ated_', '')<br>
   Â  Â  func.__qualname__ = func.__qualname__.replace('_de<wbr>precated_', '')<br>
   Â  Â  return func<br>
<br>
   @keep_pickleable<br>
   def _deprecated_old_function(arg, other):<br>
   Â  Â  ...<br>
</blockquote>
<br></span>
I would create more standard helpers (for deprecation, for lazy importing). This feature is helpful not by itself, but because it will be used for implementing new features. Using __getattr__ directly will need to write a boilerplate code. Maybe when implementing these helper you will discover that this PEP needs some additions.<br>
<br>
<br></blockquote><div><br></div><div>But in which module these helpers should live?</div><div><br></div><div>--</div><div>Ivan</div><div><br></div><div><br></div></div><br></div></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4