On Wed, 1 Dec 2021 at 19:38, Abdulla Al Kathiri
<[email protected]> 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
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/7ABVKI7YBIHLOHAVVWB5USPOGHU4TNUH/
Code of Conduct: http://python.org/psf/codeofconduct/