Raymond Hettinger <raymond.hettin...@gmail.com> 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 are first created.  At 
that earlier stage it possible to give a more timely response to erroneous 
input and there is access to more information (such as the line and row number 
of an error in a configuration file).  

It doesn't make sense to me to defer value validation downstream after a 
ChainMap instance has been formed and after a successful lookup has occurred. 
That just complicates the task of tracing back to the root cause.

> Maybe the method could be called ChainMap.search?

That would be better than get_where().

----------

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

Reply via email to