What's the best way to define a helper variable in a one-line expression in Python? I've found two: list comprehension and the "walrus" operator, but both can be somewhat clunky.

**Example**:

Suppose I want to create a one-line lambda sort function to sort dates from US date format into chronological order. I'm going to split the string into a 3-tuple consisting of month-date-year, store that tuple in a helper variable `mdy`, and then use the elements of the tuple as keys in the sort.

I could do this using list comprehension:

```
bash-3.2$ python3
>>> usdates=["2/1/2022", "1/2/2022", "12/31/2021"]
>>> f = lambda x: [(mdy[2], mdy[0], mdy[1]) for mdy in [x.split("/")]][0] 
>>> sorted(usdates, key=f)
['12/31/2021', '1/2/2022', '2/1/2022']

```

or by using the "walrus" operator inside an "if" clause:

```
bash-3.2$ python3
>>> usdates=["2/1/2022", "1/2/2022", "12/31/2021"]
>>> f = lambda x: (mdy[2], mdy[0], mdy[1]) if (mdy:=x.split("/")) else "ERROR!"
>>> sorted(usdates, key=f)
['12/31/2021', '1/2/2022', '2/1/2022']

```

Both methods are somewhat clunky. List comprehension requires unwrapping of a single-element list. But the walrus operator can be used only in an "if" or similar clause, which in turn requires an "else" statement.

What I'm really looking for is something like this:

```
bash-3.2$ python3
>>> f = lambda x: with x.split("/") as mdy: (mdy[2], mdy[0], mdy[1])
  File "<stdin>", line 1
    f = lambda x: with x.split("/") as mdy: (mdy[2], mdy[0], mdy[1])
                  ^
SyntaxError: invalid syntax
>>>

```

Is there any way to do something like this in Python 3? Thanks!

EDIT: In response to the comments so far saying "don't do this!" -- I understand that this may not be the most idiomatic way to use Python, but I'm interested in finding ways to perform custom sorting that can be easily called from the command-line, perhaps in a pipeline with shell commands.

My main question is whether Python has any better "syntactic sugar" than what I've already found. If the answer's "no", that's fine. Cheers!