A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-June/036047.html below:

[Python-Dev] PEP-317

[Python-Dev] PEP-317Tim Peters tim.one@comcast.net
Mon, 09 Jun 2003 11:28:12 -0400
[Terence Way]
> There is a rather pleasing symmetry between
>      raise SomeClass, arg
> and
>      assert expr, arg
>
> Is this intentional?  If so, should the assert form be deprecated as
> well?

The symmetry is purely syntactic, and is misleading:  assert is a control
structure, and doesn't evaluate "arg" unless the runtime value of expr is
false.  For example,

>>> assert True, 1/0
>>> assert False, 1/0
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ZeroDivisionError: integer division or modulo by zero
>>>

raise always evaluates its arg.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4