New submission from Joe Jevnik:

This proposes the following syntax for creating OrderedDict literals:

OrderedDict[k1: v1, k2: v2, ...]

This is implemented by putting a metaclass on OrderedDict which has a getitem 
that turns the slices into a list of tuples (after validation).

The idea is taken from the library datashape where we have done this to 
implement pseudo literals for the Record type.

This is marked as  WIP because I am not quite sure why, but this patch is 
causing subclasses of OrderedDict to segfault in PyObject_SetItem.

----------
components: Library (Lib)
files: odict_literals.patch
keywords: patch
messages: 268954
nosy: llllllllll
priority: normal
severity: normal
status: open
title: OrderedDict pseudo-literals (WIP)
versions: Python 3.6
Added file: http://bugs.python.org/file43495/odict_literals.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27359>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to