Skip to content

Commit 830b87c

Browse files
committed
Delete redundant summation function
1 parent 13b4b8a commit 830b87c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

06_distributed_advanced.ipynb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,9 @@
540540
"def ratio(a, b):\n",
541541
" return a // b\n",
542542
"\n",
543-
"@delayed\n",
544-
"def summation(*a):\n",
545-
" return sum(a)\n",
546-
"\n",
547543
"ina = [5, 25, 30]\n",
548544
"inb = [5, 5, 6]\n",
549-
"out = summation(*[ratio(a, b) for (a, b) in zip(ina, inb)])\n",
545+
"out = delayed(sum)([ratio(a, b) for (a, b) in zip(ina, inb)])\n",
550546
"f = c.compute(out)\n",
551547
"f"
552548
]
@@ -571,7 +567,7 @@
571567
"cell_type": "markdown",
572568
"metadata": {},
573569
"source": [
574-
"But if we introduce bad input, an exception is raised. The exception happens in `ratio`, but only comes to our attention when calculating `summation`."
570+
"But if we introduce bad input, an exception is raised. The exception happens in `ratio`, but only comes to our attention when calculating the sum."
575571
]
576572
},
577573
{
@@ -586,7 +582,7 @@
586582
"source": [
587583
"ina = [5, 25, 30]\n",
588584
"inb = [5, 0, 6]\n",
589-
"out = summation(*[ratio(a, b) for (a, b) in zip(ina, inb)])\n",
585+
"out = delayed(sum)([ratio(a, b) for (a, b) in zip(ina, inb)])\n",
590586
"f = c.compute(out)\n",
591587
"c.gather(f)"
592588
]

0 commit comments

Comments
 (0)