[Python-ideas] Enhancing vars()

Steven D'Aprano steve at pearwood.info
Tue Dec 13 18:56:46 EST 2016


On Tue, Dec 13, 2016 at 11:53:44AM +0000, Paul Moore wrote:
[...]
> There's obviously a speed-up from avoiding repeated getattr calls, but
> is speed the key here?

Not for me.

> The advantage of an "enhanced vars" is more likely to be ease of
> discoverability, and I'm not sure dict.fromattrs gives us that
> benefit. Also, the dict constructor gives a *copy* of the namespace,
> where the proposal was for the proxy returned by vars() to provide
> update capability (if I understand the proposal correctly).

Correct.



-- 
Steve


More information about the Python-ideas mailing list