Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Thanks. And do you know anything in the standard library which sounds like what I have in the question? Commented Sep 12, 2015 at 15:34
  • I'd find it difficult to quote something using nested functions, indeed I don't find nonlocal anywhere in my currently installed python libs. Perhaps you can take heart from textwrap.py which has a TextWrapper class, but also a def wrap(text) function which simply creates a TextWrapper instance, calls the .wrap() method on it and returns. So use a class, but add some convenience functions. Commented Sep 12, 2015 at 15:51