Tokens?
Fredrik Lundh
fredrik at pythonware.com
Tue Apr 18 07:46:58 EDT 2006
"BBands" wrote:
> In the invaluable 'Dr. Dobb's Python-URL! - weekly Python news and
> links' of April 17 Peter Otten writes: "Michele Simionato's little
> script lets you search for a name in Python scripts, avoiding false
> positives that a standard tool like grep would yield." Can someone
> explain why this is so?
consider grepping for "main" in this script:
def main():
# this is the main function
print "hello, main"
if __name__ == "__main__":
main()
a standard grep will find five instances. a word grep will find four. a name
token grep will find two.
</F>
More information about the Python-list
mailing list