That's a good point.

It might be better to disallow the list and set versions all together. To
get a list or set you would instead have to explicitly unpack a range/slice
object:

[*(:5)] # [:5] no longer allowed

{*(1:6)} # {1:6} is a dict

That would also solve the misstep of the three-character infinite list.

On Sat, Nov 10, 2018 at 11:00 PM Chris Angelico <ros...@gmail.com> wrote:

> On Sun, Nov 11, 2018 at 4:59 PM Nicholas Harrison
> <nicholasharrison...@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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to