Are nested try/except blocks in python a good programming practice?

后端 未结 11 2074
情歌与酒
情歌与酒 2020-12-07 08:33

I\'m writing my own container, which needs to give access to a dictionary inside by attribute calls. The typical use of the container would be like this:

dic         


        
11条回答
  •  庸人自扰
    2020-12-07 09:19

    In Python it is easier to ask for forgiveness than permission. Don't sweat the nested exception handling.

    (Besides, has* almost always uses exceptions under the cover anyways.)

提交回复
热议问题