Issue 10386: token module should define all (original) (raw)

Issue10386

Created on 2010-11-11 04:06 by belopolsky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
token-all.diff belopolsky,2010-11-11 04:06
Messages (3)
msg120938 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-11-11 04:06
The token module appears to be designed to be used with import *. In fact it is used this way in the tokenize module. However it does not define __all__ and as a result, from token import * leaks symbol "main": >>> import tokenize >>> tokenize.main.__module__ 'token' Attached patch adds token.__all__ and "modernizes" generation of the tok_name dictionary. I also renamed main to _main because it is hard to imagine that any user code would ever want to use it.
msg120949 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2010-11-11 13:47
Normally, I'd recommend leaving the "main" name alone, but in the case of modules that use it as an tool for module maintenance (symbol, token), I don't think it matters either way. Ok to commit.
msg120952 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-11-11 14:10
Committed revision 86410.
History
Date User Action Args
2022-04-11 14:57:08 admin set github: 54595
2010-11-11 14:11:27 belopolsky set status: open -> closed
2010-11-11 14:10:41 belopolsky set messages: +
2010-11-11 13:47:29 fdrake set nosy: + fdrakemessages: + assignee: belopolskyresolution: accepted
2010-11-11 04:06:52 belopolsky create