Aliases, multi-imports, and the `np.` you'll see everywhere — step 7 of 9
Cursor wrote this and sum no longer works the way it should. The bug:
from math import * pulled in everything from math, including
math.fsum, but more importantly the user also defined a local variable
called sum, which silently shadows Python's built-in sum() function.
Replace the star import on line 1 with a targeted import that only brings
in pi and sqrt. After that, sum([1, 2, 3]) works again. The script
should print:
3.141592653589793
9.0
6
Cursor wrote this and sum no longer works the way it should. The bug:
from math import * pulled in everything from math, including
math.fsum, but more importantly the user also defined a local variable
called sum, which silently shadows Python's built-in sum() function.
Replace the star import on line 1 with a targeted import that only brings
in pi and sqrt. After that, sum([1, 2, 3]) works again. The script
should print:
3.141592653589793
9.0
6
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.