The symbol Module

The symbol module, used in Example 13-20, contains a listing of non-terminal symbols from the Python grammar. It’s probably only useful if you’re dabbling with the parser module.

Example 13-20. Using the symbol Module

File: symbol-example-1.py

import symbol

print "print", symbol.print_stmt
print "return", symbol.return_stmt

print 268
return 274

Get Python Standard Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.