[Python-Dev] PEP 562 (original) (raw)

Serhiy Storchaka storchaka at gmail.com
Wed Nov 15 02:43:47 EST 2017


14.11.17 22:34, Ivan Levkivskyi пише:

This function will be called only if name is not found in the module through the normal attribute lookup.

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.

Backwards compatibility and impact on performance =================================================

What is affect on pydoc, word completion, inspect, pkgutil, unittest?

def keeppickleable(func): func.name = func.name.replace('deprecated', '') func.qualname = func.qualname.replace('deprecated', '') return func

@keeppickleable def deprecatedoldfunction(arg, other): ...

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.



More information about the Python-Dev mailing list