[Python-ideas] get() method for list and tuples

Ethan Furman ethan at stoneleaf.us
Fri Mar 3 14:43:03 EST 2017


On 03/03/2017 10:29 AM, Ed Kellett wrote:

> - Which of the existing things (slice + [default], conditional on a slice, conditional on a len() call) do you think is
> the obvious way to do it?

[my_value] = some_list[offset:offset+1] or [default_value]

--
~Ethan~


More information about the Python-ideas mailing list