Confusing textwrap parameters, and request for RE help

Chris Angelico rosuav at gmail.com
Mon Mar 30 17:32:49 EDT 2020


On Tue, Mar 31, 2020 at 8:20 AM Peter Otten <__peter__ at web.de> wrote:
>
> Chris Angelico wrote:
> > but an awkward way to spell it. If you mean to call the original wrap
> > method, it would normally be spelled super().wrap(para) instead.
>
> Probably a workaround because super() cannot do its magic in the list
> comprehensions namespace. Another workaround is to define
>
> wrap = super().wrap
>
> and then use just wrap() in the listcomp.
>

Ah ha, I didn't think of that. And yes, I would agree, that's probably
the cleanest way. Alternatively, the longhand super(__class__, self)
should work too, as I believe __class__ isn't redefined by the
implicit closure.

ChrisA


More information about the Python-list mailing list