[Python-ideas] Enhancing vars()

Steven D'Aprano steve at pearwood.info
Tue Dec 13 05:02:23 EST 2016


On Tue, Dec 13, 2016 at 10:29:38AM +0100, Marco Buttu wrote:

> +1. Would it be possible in the future (Py4?) to change the name `vars` 
> to a more meaningful name? Maybe `namespace`, or something more appropriate.

I'm not keen on the name vars() either, but it does make a certain 
sense: short for "variables", where "variable" here refers to attributes 
of an instance rather than local or global variables.

I'm not sure that namespace is a better name: namespace, it seems to me, 
it likely to be used as the name of the target:

namespace = vars(obj)

But if there is a lot of popular demand for a name change, then I 
suppose it could happen.

Ask again around Python 3.9 :-)



-- 
Steve


More information about the Python-ideas mailing list