Movatterモバイル変換
[0]ホーム
[Python-Dev] Keyword module cruft question
Patrick K. O'Brienpobrien@orbtech.com
Tue, 29 Oct 2002 16:21:58 -0600
I'm working on an article about Python introspection and came across some=thing=20I consider a blemish. I thought I'd ask about it here and see how you fol=ks=20feel 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'>>>=20Basically, the keyword attribute is just the last value from this process=:kwdict =3D {}for keyword in kwlist: kwdict[keyword] =3D 1So it is a bit of extraneous cruft, I believe. No big deal, and nothing t=hat adel keywordcouldn't fix. But it does look sloppy when you are writing about introspe=ction=20and you see an attribute that has no real value. I wish it weren't there,= as=20I'd rather not have to explain it. But it got me thinking whether other=20modules in the standard library have this issue, and whether this is=20something that should be cleaned up. Thoughts?--=20Patrick K. O'BrienOrbtechhttp://www.orbtech.com/web/pobrien-----------------------------------------------"Your source for Python programming expertise."-----------------------------------------------
[8]ページ先頭