[docs] Typo in example code in section 6.2.6.10 in python3.3 documentation
Sandro Tosi
sandro.tosi at gmail.com
Fri May 13 20:00:23 CEST 2011
Hi Vikram,
thanks for your report.
On Mon, May 2, 2011 at 19:52, Vikram Shirgur <vikramls at gmail.com> wrote:
> Hi,
>
> There seems to be a typo in the listing for section 6.2.6.10. The
> relevant code says this:
>
> #-- begin code snippet
> elif typ != 'SKIP':
> if typ == 'ID' and val in keywords:
> typ = val
> yield Token(typ, mo.group(typ), line, mo.start()-line_start)
> #-- end code snippet
>
> which results in NameError since val hasn't been defined before. It
> should be changed to:
>
> #-- begin code snippet
> elif typ != 'SKIP':
> val = mo.group(typ)
> if typ == 'ID' and val in keywords:
> typ = val
> yield Token(typ, val, line, mo.start()-line_start)
> #-- end code snippet
>
> I added a statement (val = mo.group(typ)) to assign a value to val
> before it is accessed.
It's already been fixed in http://hg.python.org/cpython/rev/538a6b23b18f/
Regards,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
More information about the docs
mailing list