mirror of
https://github.com/python/cpython.git
synced 2025-08-09 19:38:42 +00:00
Update uses of string exceptions
This commit is contained in:
parent
0bef15846f
commit
d9a9c1066c
4 changed files with 7 additions and 9 deletions
|
@ -8,10 +8,8 @@
|
|||
import sys
|
||||
from math import sqrt
|
||||
|
||||
error = 'fact.error' # exception
|
||||
|
||||
def fact(n):
|
||||
if n < 1: raise error # fact() argument should be >= 1
|
||||
if n < 1: raise ValueError # fact() argument should be >= 1
|
||||
if n == 1: return [] # special case
|
||||
res = []
|
||||
# Treat even factors special, so we can use i = i+2 later
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue