Spell-checking Python source code
David
wizzardx at gmail.com
Mon Sep 10 02:27:11 EDT 2007
On 9/9/07, David <wizzardx at gmail.com> wrote:
> > tokenize.tokenize(
> > file.readline,
> > processStrings
> > )
> >
> > How would you go about writing the output to a file? I mean, I would
> > like to open the file at main level and pass a handle to the file to
> > processStrings to write to it, finally close output file at main level.
> > Probably a class with a processString method?
>
You can also use closures for this.
http://ivan.truemesh.com/archives/000411.html
See the example in the "Assignment considered awkward" section. Since
you're not assigning to your file variable in processStrings you don't
have to use the list work-around mentioned later in the doc.
More information about the Python-list
mailing list