Chris Angelico writes:
 > On Wed, Jun 10, 2020 at 1:15 PM Stephen J. Turnbull
 > <turnbull.stephen...@u.tsukuba.ac.jp> 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.
 > 
 > Be careful with this assumption. Python's dictionaries DO retain
 > order,

Thank you for the reminder!  I did forget that point.

 > even if you can't easily talk about "the fifth element" [1], so
 > anything that imposes requirements on the entry listed
 > syntactically first may have consequences.

No requirements imposed!  If iteration order matters and you want to
take advantage of abbreviation, you might have to write

    d = {first : first, last, addr1, addr2, tel='123-456-789'}

but frequently it would just work naturally:

    d = {first : first, last, addr1, addr2}

Admittedly this distinction may be even more subtle than grit on Tim's
screen, or randomizing the hash seed per process.  And I suspect that
people who want this feature will prefer the d{} notation for
consistency inside the braces.

Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ENXYVRXOAEOBWHN6SQK5K4IJUTRHHXLB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to