[issue9515] vars() dictionary access to generate variables

Dan L report at bugs.python.org
Wed Aug 4 20:39:47 CEST 2010


New submission from Dan L <choralreef at naver.com>:

Perhaps it's assumed that you should know about this by knowing about how the vars dictionary is implemented, but to someone unfamiliar like me it seems like the builtin functions documentation for vars() should mention that you can create a variable name from a string using vars()['string_containing_variable_name'] = value, i.e. 

>>> vars()['hi']=3
>>> hi
3
>>>


Just to include text for a possible fix (to be appended to the existing description):

"You can create a variable name from a string using vars()['string_containing_variable_name'] = value, i.e. 

>>> vars()['hi']=3
>>> hi
3
>>>"

----------
assignee: docs at python
components: Documentation
messages: 112857
nosy: docs at python, jdan
priority: normal
severity: normal
status: open
title: vars() dictionary access to generate variables
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9515>
_______________________________________


More information about the Python-bugs-list mailing list