I'm working on an article about Python introspection and came across some= thing=20 I consider a blemish. I thought I'd ask about it here and see how you fol= ks=20 feel about it. BTW, I'm looking at Python 2.2.2 on Linux. If you look at the keyword module, you'll see that it has a keyword attri= bute: >>> import keyword >>> dir(keyword) ['__all__', '__builtins__', '__doc__', '__file__', '__name__', 'iskeyword= ',=20 'keyword', 'kwdict', 'kwlist', 'main'] >>> keyword.keyword 'yield' >>>=20 Basically, the keyword attribute is just the last value from this process= : kwdict =3D {} for keyword in kwlist: kwdict[keyword] =3D 1 So it is a bit of extraneous cruft, I believe. No big deal, and nothing t= hat a del keyword couldn't fix. But it does look sloppy when you are writing about introspe= ction=20 and you see an attribute that has no real value. I wish it weren't there,= as=20 I'd rather not have to explain it. But it got me thinking whether other=20 modules in the standard library have this issue, and whether this is=20 something that should be cleaned up. Thoughts? --=20 Patrick K. O'Brien Orbtech http://www.orbtech.com/web/pobrien ----------------------------------------------- "Your source for Python programming expertise." -----------------------------------------------
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4