On Wed, Jul 01, 2020 at 12:10:12PM +0100, Rhodri James wrote: > On 01/07/2020 11:24, Steven D'Aprano wrote: > >On Tue, Jun 30, 2020 at 07:40:23PM +0100, Rhodri James wrote: > > > >>Don't get me wrong, if it's not going to cause performance issues I > >>think being able to index views would be great > > > >What are your use-cases for indexing set-like views of a dict? > > Personally none, but that's because I still don't treat dicts as being > ordered and arrange my data structures accordingly. I seem to remember > the OP having a use case, and I can imagine people who have ordering > ingrained in their style rather harder than me could find uses.
The OP's use-case, as far as I can tell, would not actually be helped by adding indexing to dicts. He has a table of columns, and needs to insert and delete columns into any position, including slices of multiple columns. As far as I can see, the OP should be using a list of columns, not a dict, perhaps augmented by a mapping of column-names to column position (assuming the names are unique). Or maybe some fancier data structure designed for this purpose. -- Steven _______________________________________________ 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/2P5RAUPHTIECW3ZDZAIUX5D4SGHBEDPR/ Code of Conduct: http://python.org/psf/codeofconduct/