deshaw / pyflyby

A set of productivity tools for Python
https://deshaw.github.io/pyflyby/
Other
347 stars 52 forks source link

Don't rely on method monkey patching #321

Closed Carreau closed 5 months ago

Carreau commented 5 months ago

It is hard to reason about code when monkey patched and methods are overwritten.

This had two methods/property: joined() and lines() calling each other, and depending on how the object was constructed one was replaced by an attribute.

Is is convoluted and make static inference difficult.

Move to private attribute and always storing _lines (as a list of strings that are not terminated by newlines.