I'm new to Python, and want to make sure I'm doing this the most Pythonic way.
I have a string with a form of something like this:
VAR=(X=Y)
And I need everything to the right of the first = (including any and all subsequent =).
Since rsplit() works right to left, this is how I did it:
definition=line[::-1].rsplit('=', 1)[0][::-]
I reverse it, then split it on the =, take the first element of that split (everything to the left of the last =, or everything to the right of the first = in the unreversed string), then reverse it to get it forward again.
Is there a better, or more idiomatic, way to do this?