开发者

Difference between raise Exception, "foo" and raise Exception("foo")?

开发者 https://www.devze.com 2023-03-14 15:58 出处:网络
The title is pretty self explanatory -- what\'s the difference between: raise Exception, \"foo\" a开发者_开发问答nd

The title is pretty self explanatory -- what's the difference between:

raise Exception, "foo"

a开发者_开发问答nd

raise Exception("foo")

Does it do exactly the same thing, just different syntax?

I'm using Python 2.x, but I'd like to hear of any differences in Python 3.x


both amount to the same thing in Python2. in Python3, the raise Exception, "foo" syntax is no longer supported.

0

精彩评论

暂无评论...
验证码 换一张
取 消