On Mon, Aug 24, 2020 at 12:54 AM Random832 <[email protected]> wrote:
> > Why not allow slice syntax as an expression everywhere?
>
> is {a:b} a set containing a slice, or a dict? obviously it's a dict, but
> are there any other places that might be affected?
should we support {a, b:c} as a set containing a slice? what about {a:b, c}?
>
well, slices aren't hashable, so no. though technically hashabily is not a
syntax issue. So if a:b:c was a valid expressson anywhere, then you should
be able to *try* putting in in a set ...
but {a:b:1} is now a syntax error, so we could make only the three-part
form allowable.
> there may be other places it might be desirable to add new syntax that
> uses the colon character, allowing slices anywhere would foreclose that.
>
well, not sure I agree that that's a strong motivator.
I do think the dict display issue is big one though. But maybe we could
expand where slices can be used, like function calls, for instance:
though *maybe* there would be less use for that if.when we get keywords in
the [] operator.
-CHB
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/CEF2MFP6WA4RKRV4TNWCDTNLAPZ243VD/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
--
Christopher Barker, PhD
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/QCUP73M5KPPBC7YSKPRB4DLWJOOKV2SH/
Code of Conduct: http://python.org/psf/codeofconduct/