[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread Abe Dillon
> > instead of prefixing a letter, we may be able to omit the key of > items inside dict display. d = {:name, :addr, ’tel': '123-4567’} > This is my favorite variation on the notation so far. I'll give it a +1 On Wed, Jun 10, 2020 at 10:49 AM Atsuo Ishimoto wrote: > Hi > Thank you for

[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread Robert DeLanghe
I like Atsou's suggestion of omitting the key for literals: d = {:name, :addr, ’tel': '123-4567’} but using empty kwargs feels gross: d = dict(=name, =addr, tel='123-456') And this feels like it could easily lead to confusion: d = dict(name, addr, tell='123-456') On Thu, Jun 11, 2020 at

[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread Abe Dillon
Stephen J. Turnbull > d = {first : first, last, addr1, addr2} I'm not a huge fan of this solution. It feels a bit like a hack instead of an intended syntax. Since prefixing characters on strings is already a thing, I lean more towards that solution. It's slightly easier to search (e.g. if the

[Python-ideas] Re: New syntax for dict literals

2020-06-11 Thread J. Pic
I find this interesting, another solution would be for locals() to take arguments: dict(tel='1337-1337', **locals('name', 'surname')) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: New syntax for dict literals

2020-06-10 Thread Atsuo Ishimoto
Thank you. It unfortunately happens to me mostly while I'm working for REST web servers, especially when writing JSON in the test suites for the app. 2020年6月11日(木) 1:24 Rhodri James : > > On 10/06/2020 16:38, Atsuo Ishimoto wrote: > > Hi > > Thank you for comments > > > > 2020年6月10日(水) 0:11

[Python-ideas] Re: New syntax for dict literals

2020-06-10 Thread Rhodri James
On 10/06/2020 16:38, Atsuo Ishimoto wrote: Hi Thank you for comments 2020年6月10日(水) 0:11 Rhodri James : Python is not Perl. By that I mean Python in general tends not to use non-alphanumeric symbols unless they already have a well established meaning (such as quote marks, arithmetic operators

[Python-ideas] Re: New syntax for dict literals

2020-06-10 Thread Atsuo Ishimoto
Hi Thank you for comments 2020年6月10日(水) 12:12 Stephen J. Turnbull : > DTRTs. How often would locals() be usable in this way? Note: in the > case of requests, this might be a vulnerability, because the explicit > dict display would presumably include only relevant items, while > locals() might

[Python-ideas] Re: New syntax for dict literals

2020-06-10 Thread Atsuo Ishimoto
Hi Thank you for comments 2020年6月10日(水) 0:11 Rhodri James : > > Python is not Perl. By that I mean Python in general tends not to use > non-alphanumeric symbols unless they already have a well established > meaning (such as quote marks, arithmetic operators and so on). Yeah, I don't think

[Python-ideas] Re: New syntax for dict literals

2020-06-10 Thread Stephen J. Turnbull
Chris Angelico writes: > On Wed, Jun 10, 2020 at 1:15 PM Stephen J. Turnbull > wrote: > > > > Executive summary: > > > > Dicts are unordered, so we can distinguish dict from set by the first > > item (no new notation), and after that default identifiers to (name : > > in-scope value)

[Python-ideas] Re: New syntax for dict literals

2020-06-10 Thread Chris Angelico
On Wed, Jun 10, 2020 at 1:15 PM Stephen J. Turnbull wrote: > > Executive summary: > > Dicts are unordered, so we can distinguish dict from set by the first > item (no new notation), and after that default identifiers to (name : > in-scope value) items. Also some notational bikeshedding. Be

[Python-ideas] Re: New syntax for dict literals

2020-06-09 Thread Rhodri James
Hi there! This request is a close cousin of the recent discussion about optional keywords arguments, which you can find in the archives at https://mail.python.org/archives/list/python-ideas@python.org/thread/MILIX6HSW3PRUNWWP6BN2G2D7PXYFZJ7/ A lot of the same comments for and against apply