
On Wed, 1 Dec 2021 at 19:38, Abdulla Al Kathiri <alkathiri.abdulla@gmail.com> wrote:
number = text -> re.search(pattern1, _) -> re.search(pattern2, _.group(0)) -> re.search(pattern3, _.group(1)) -> float(_.group(0))
Yeah that can look ugly I agree (here intentionally the placeholder is overused).
It looks like you could just write as follows without using any placeholder number = text -> (pattern1 -> re.search)().group(0)\ -> (pattern2 -> re.search)().group(1)\ -> (pattern3 -> re.search)().group(0)\ -> float() but anyway, a question seems: once you start chaining applications of functions from the right, might you start wanting assignment (expression) to the right (of an object on the lhs to a variable on the rhs)? I think that could be easier with chained applications from the right for the reader of the code. Best regards, Takuo Matsuoka