From 09190394388163ef7df51c76bb33077ec8fc0949 Mon Sep 17 00:00:00 2001 From: Vivien Maisonneuve Date: Tue, 19 Aug 2014 00:06:00 +0200 Subject: [PATCH] Reorder functions in linexprs.py --- linpy/linexprs.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/linpy/linexprs.py b/linpy/linexprs.py index 834c3b4..fce77a6 100644 --- a/linpy/linexprs.py +++ b/linpy/linexprs.py @@ -518,6 +518,21 @@ class Symbol(LinExpr): raise TypeError('expr must be a sympy.Symbol instance') +def symbols(names): + """ + This function returns a tuple of symbols whose names are taken from a comma + or whitespace delimited string, or a sequence of strings. It is useful to + define several symbols at once. + + >>> x, y = symbols('x y') + >>> x, y = symbols('x, y') + >>> x, y = symbols(['x', 'y']) + """ + if isinstance(names, str): + names = names.replace(',', ' ').split() + return tuple(Symbol(name) for name in names) + + class Dummy(Symbol): """ A variation of Symbol in which all symbols are unique and identified by @@ -571,21 +586,6 @@ class Dummy(Symbol): return '$${}_{{{}}}$$'.format(self.name, self._index) -def symbols(names): - """ - This function returns a tuple of symbols whose names are taken from a comma - or whitespace delimited string, or a sequence of strings. It is useful to - define several symbols at once. - - >>> x, y = symbols('x y') - >>> x, y = symbols('x, y') - >>> x, y = symbols(['x', 'y']) - """ - if isinstance(names, str): - names = names.replace(',', ' ').split() - return tuple(Symbol(name) for name in names) - - class Rational(LinExpr, Fraction): """ A particular case of linear expressions are rational values, i.e. linear -- 2.20.1