Alexander Belopolsky added the comment:

> Catch would be fine with me :)

Both "catch" and "trap" have the same problem in my view: you don't get to eat 
what you have caught (or trapped).  :-)


> Please note that someone *reading the thread* on python-dev
> misunderstood what ignore did after *reading the documentation*.

I question whether the confusion was genuine.  Anyone who has discovered 
contextlib modules should know enough about with statement, context managers 
and exceptions to understand how ignore() can work.  Sky is the limit when it 
comes to documentation improvements, but in this case code is better than a 
thousand words:

  @contextmanager
  def ignore(*exceptions):
    """Context manager to ignore particular exceptions"""
    try:
        yield
    except exceptions:
        pass


Here is how I understand the word "ignore" in the context of context managers. 
(Pun unavoidable.)  The context manager implements logic of how to exit the 
with block.  The logic of ignore() CM is to (drum roll, please) ignore the 
specified exception(s) if any is raised within the with block.

I gave my +0 to "suppress" on the list, but with more thought and considering 
more examples, I like "ignore" best.  It is still a close call, but "suppress" 
suggests more effort on the part of CM than there is.

----------

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

Reply via email to