Is there a way to determine -- when parsing -- if a word contains a builtin name or other imported system module name?

David M. Cooke cookedm+news at physics.mcmaster.ca
Thu Aug 4 17:45:37 EDT 2005


Casey Hawthorne <caseyhHAMMER_TIME at istar.ca> writes:

> Is there a way to determine -- when parsing -- if a word contains a
> builtin name or other imported system module name?
>
> Like "iskeyword" determines if a word is a keyword!

Look in the keyword module; there is actually an "iskeyword" function
there :)

For modules, sys.modules is a dictionary of the modules that have been
imported.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list