[Python-ideas] Range and slice syntax

Chris Angelico rosuav at gmail.com
Sun Nov 11 01:00:59 EST 2018


On Sun, Nov 11, 2018 at 4:59 PM Nicholas Harrison
<nicholasharrison222 at gmail.com> wrote:
> It has a couple of siblings that should be obvious (think list or set comprehension):
>
> [start:stop:step] # gives a list
> {start:stop:step} # gives a set
>

Be careful of this last one. If you omit the step, it looks like this:

{start:stop}

which is a dictionary display.

ChrisA


More information about the Python-ideas mailing list