[Python-ideas] Enhancing vars()
Matt Gilson
matt at getpattern.com
Tue Dec 13 13:33:01 EST 2016
<snip>
> It also refers to local and global variables, as vars() is effectively
> an alias for locals() if you don't pass an argument, and locals() is
> effectively an alias for globals() at module level:
>
> </snip
I was actually hoping that someone might propose to deprecate this
behavior. Why do we need a cascade of namespaces looked up by `vars` (and
`locals`)?. It seems to me that this just complicates what these functions
do and I don't see a clear reason for it. Having a function do only one
thing might also help promote it's use in the cases where we want it to be
used (e.g. instead of accessing `__dict__` directly).
Of course, that might be too big a change to make any time soon... but a
guy can hope can't he? :-)
--
[image: pattern-sig.png]
Matt Gilson // SOFTWARE ENGINEER
E: matt at getpattern.com // P: 603.892.7736
We’re looking for beta testers. Go here
<https://www.getpattern.com/meetpattern> to sign up!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161213/c3e4fd16/attachment.html>
More information about the Python-ideas
mailing list