¡@

Home 

python Programming Glossary: chapterreplacer

Need help understanding Python closures

http://stackoverflow.com/questions/11057432/need-help-understanding-python-closures

I have this code import re def doReplace toReplace i 1 def chapterReplacer _ result 'Chapter i' i i 1 return result return re.sub 'Chapter.. i' i i 1 return result return re.sub 'Chapter a zA Z ' chapterReplacer test test 'Chapter one Chapter Two Chapter three' print doReplace.. line 10 in doReplace return re.sub 'Chapter a zA Z ' chapterReplacer test File C Python26 lib re.py line 151 in sub return _compile..