This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lukasz.langa
Recipients lukasz.langa
Date 2010-11-21.12:30:53
SpamBayes Score 8.437695e-15
Marked as misclassified No
Message-id <1290342654.96.0.351171202849.issue10489@psf.upfronthosting.co.za>
In-reply-to
Content
I want to sum up all strange things about the behaviour of `__name__`, a special key present in every section of a parser instance.

1. There is a special `__name__` key in every section.
2. Except for the DEFAULTSECT.
3. `__name__` key is set for every section read from a file.
4. and not when adding by `add_section()`.
5. if `__name__` does exist, it's not visible in `parser.options('section')`
6. but it is visible here: `parser.has_option('section', '__name__') == True`
7. and can be obtained by `parser.get('section', '__name__')`
8. and can be changed by `parser.set('section', '__name__', 'ANY VALUE')`
9. and can be removed by `parser.remove_option('section', '__name__')`
10. even if the value is changed by `parser.set()`, it won't be written back to a file with `parser.write()`

All this looks like a feature that was not particularly complete and well defined when it was first created. Or possibly, it became rotten with time and now nobody is using it anyway. That way or the other, I couldn't come up with a valid use case for `__name__` with the current implementation. It doesn't serve any internal purpose and the *only* way you can actually get it is to `parser.get('section', '__name__')` which returns 'section' anyway. About as useless as it gets. Of course, one can go and take the internal parser._sections data structure of the parser but that's evil.

I want simply remove all mentions of a special `__name__` key in configparser.py. Backwards compatibility is not a concern here because in this case we have a concept that is so broken that you can't actually use it.
History
Date User Action Args
2010-11-21 12:30:55lukasz.langasetrecipients: + lukasz.langa
2010-11-21 12:30:54lukasz.langasetmessageid: <1290342654.96.0.351171202849.issue10489@psf.upfronthosting.co.za>
2010-11-21 12:30:53lukasz.langalinkissue10489 messages
2010-11-21 12:30:53lukasz.langacreate