# HG changeset patch
# User Volker Braun <vbraun.name@gmail.com>
# Date 1353711284 0
# Node ID ce3f0b5cd53fe83b6f0239068165f5acf8815105
# Parent 00e09c435e06b44c8f4ce7fbac399245b0a2389b
Fix bug in the (deprecated) Sum function
diff --git a/sage/numerical/mip.pyx b/sage/numerical/mip.pyx
a
|
b
|
|
2074 | 2074 | sage: Sum([]) |
2075 | 2075 | doctest:...: DeprecationWarning: use MixedIntegerLinearProgram.sum() instead |
2076 | 2076 | See http://trac.sagemath.org/13646 for details. |
| 2077 | |
| 2078 | sage: p = MixedIntegerLinearProgram() |
| 2079 | sage: x = p.new_variable() |
| 2080 | sage: Sum([ x[0]+x[1], x[1]+x[2], x[2]+x[3] ]) # deprecation is only shown once |
| 2081 | x_0 + 2*x_1 + 2*x_2 + x_3 |
2077 | 2082 | """ |
2078 | 2083 | from sage.misc.superseded import deprecation |
2079 | 2084 | deprecation(13646, 'use MixedIntegerLinearProgram.sum() instead') |
2080 | 2085 | if not x: |
2081 | 2086 | return None |
2082 | | parent = x[0] |
| 2087 | parent = x[0].parent() |
2083 | 2088 | return parent.sum(x) |