[issue34586] collections.ChainMap should have a get_where method

2018-09-11 Thread Zahari Dim
Zahari Dim added the comment: > > I've discussed this with other core devs and spent a good deal of time > evaluating this proposal. I'm going to pass on the this one but do think it > was a inspired suggestion. Thank you for the proposal. Thank you for taking the time to consider it. I

[issue34586] collections.ChainMap should have a get_where method

2018-09-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've discussed this with other core devs and spent a good deal of time evaluating this proposal. I'm going to pass on the this one but do think it was a inspired suggestion. Thank you for the proposal. -- Note, the original get_where() recipe

[issue34586] collections.ChainMap should have a get_where method

2018-09-08 Thread Zahari Dim
Zahari Dim added the comment: On Sat, Sep 8, 2018 at 1:15 PM Serhiy Storchaka wrote: > > > Serhiy Storchaka added the comment: > > I concur with Raymond. The purpose of ChainMap is providing a mapping that > hides the implementation detail of using several mappings as fallbacks. If > you

[issue34586] collections.ChainMap should have a get_where method

2018-09-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Raymond. The purpose of ChainMap is providing a mapping that hides the implementation detail of using several mappings as fallbacks. If you don't want to hide the implementation detail, you don't need to use ChainMap. ChainMap exposes

[issue34586] collections.ChainMap should have a get_where method

2018-09-07 Thread Zahari Dim
Zahari Dim added the comment: > ISTM that this is the wrong stage to perform validation of allowable values. > That should occur upstream when the underlying mappings are first created. > At that earlier stage it possible to give a more timely response to erroneous > input and there is

[issue34586] collections.ChainMap should have a get_where method

2018-09-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I would argue that all of the examples would benefit from error > checking done along the lines of the snippet above. ISTM that this is the wrong stage to perform validation of allowable values. That should occur upstream when the underlying mappings

[issue34586] collections.ChainMap should have a get_where method

2018-09-06 Thread Zahari Dim
Zahari Dim added the comment: I believe an argument for including this functionality in the standard library is that it facilitates writing better error messages and thus better code. Some results that are returned when one searches for *python ChainMap* are: -

[issue34586] collections.ChainMap should have a get_where method

2018-09-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: I haven't run across this requirement before but it does seem plausible that a person might want to know which underlying mapping found a match (compare with the "which" utility in Bash). On the other hand, we haven't had requests for anything like this

[issue34586] collections.ChainMap should have a get_where method

2018-09-05 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing

[issue34586] collections.ChainMap should have a get_where method

2018-09-05 Thread Zahari Dim
New submission from Zahari Dim : When using ChainMap I have frequently needed to know the mapping inside the list that contains the effective instance of a particular key. I have needed this when using ChainMap to contain a piece of configuration with multiple sources, like for example ```