New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configparser: remove broken __name__
support
#54698
Comments
I want to sum up all strange things about the behaviour of
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 I want simply remove all mentions of a special |
For the record, I wrote about this problem in July on the mailing list [1], there were no replies. [1] http://mail.python.org/pipermail/python-dev/2010-July/102556.html |
Patch for the cleanup attached. 47 lines removed, about a half of these were in tests explicitly made to check for these inconsistencies. 4 lines added, all of them are reformattings due to removal of the other lines. Syntax highlighted view of the patch: |
Committed in rev 86638. A public API for getting the name of the section from a SectionProxy instance was introduced in 86639. This is useful because you can assing a section proxy to a variable and pass it around: >>> from configparser import SafeConfigParser
>>> parser = SafeConfigParser()
>>> parser.read_string("""
... [section1]
... value = A
... value2 = B
...
... [section2]
... value = C
... value2 = D
... """)
>>> section1 = parser['section1']
>>> section1['value']
'A'
>>> section1.name
'section1'
>>> section2 = parser['section2']
>>> section2['value']
'C'
>>> section2.name
'section2'
>>> section2.name = 'cannot do that, this attribute is read-only on a SectionProxy'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: can't set attribute |
__name__
keyNote: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: