|
|
|
|
|
by submeta
3206 days ago
|
|
I know the reasons why and how mutating methods work in Python. Nevertheless I find this here much more elegant: data.sort.tail.first # or this
data.append(7).append(3) More elegant than this: sorted(data)[1:][0] data.append(7) # and then data.append(3) I love method chaining in Elixir or Javascript. In Python I have to create temp variables here and there to capture / further process intermediate results. Having said that: Python has it's strengths. I use it more than any other programming language. |
|
> sorted(data)[1:][0]
I don't want to get into the weeds, but shouldn't that just be
Or if you like unpacking for clarity