小编And*_*lan的帖子

Pylint raise-missing-from

我在这段代码中有一条 pylint 消息(w0707)(来自https://www.django-rest-framework.org/tutorial/3-class-based-views/):

class SnippetDetail(APIView):
    """
    Retrieve, update or delete a snippet instance.
    """
    def get_object(self, pk):
        try:
            return Snippet.objects.get(pk=pk)
        except Snippet.DoesNotExist:
            raise Http404
Run Code Online (Sandbox Code Playgroud)

信息是:
Consider explicitly re-raising using the 'from' keyword
我不太明白如何采取行动来纠正问题。
预先感谢您的帮助

python pylint

48
推荐指数
1
解决办法
2万
查看次数

标签 统计

pylint ×1

python ×1