Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
New issue report by ondrej.certik:
symbols and var should do the same thing with the same syntax, the only
difference should be that var also injects the variables to your scope,
while symbols will only return
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #1 by ondrej.certik:
I'll take care of it.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue n
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #2 by Vinzent.Steinberg:
var() accepts assumption via keywords and symbols got the same syntax as
var():
symbols('x y z') or symbols('x,y,z') instead of symbols('xyz')
This is in my opinion more fle
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #3 by ondrej.certik:
Thanks for the patch.
I think that var should just call symbols(), the only difference is that
var also
injects them into the namespace. E.g. something along the lines:
def var(
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #4 by ondrej.certik:
As to compatibility, symbols() should have "single_character_names=True"
kwarg. And
var() will set this argument to False. Later we can switch to
single_character_names=False and
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #5 by Vinzent.Steinberg:
Yeah, it's more elegant to call symbols() from var(). The duplication is
however
minimal, so I'm +-0. But:
http://en.wikipedia.org/wiki/Don%27t_repeat_yourself
> we may exp
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #6 by Vinzent.Steinberg:
> As to compatibility, symbols() should have "single_character_names=True"
kwarg. And
> var() will set this argument to False. Later we can switch to
> single_character_names=
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #8 by ondrej.certik:
Indeed, that should work. If you cannot figure it out, I'll look at it in
the evening.
--
You received this message because you are listed in the owner
or CC fields of this is
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #7 by Vinzent.Steinberg:
There seems to be quite a mess with symbols(). It currently returns not a
list if
there's only one variable.
My current version fails and unfails some tests. I'll need to dig
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #9 by Vinzent.Steinberg:
These strange issues appear with the patch:
>>> from sympy import *
>>> [sympify(arg) for arg in (sin(x), ('x',0,1))]
[sin(x), (x, 0, 1)]
>>> integrate(*_)
sin(1)
>>> integrate
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #10 by ondrej.certik:
I don't know. But my patch passes all tests, so feel free to start with
that.
I suggest:
* make the new behavior of symbols() the default (see the patch) and add the
single_cha
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #12 by ondrej.certik:
But it's easy to understand why this happens, right?
Also, I thought the only supported syntax is var("x y z") or var("x, y, z")
the same
for symbols().
--
You received this
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #13 by Vinzent.Steinberg:
No, it's possible to do symbols(['x', 'y']) or even symbols('x', 'y').
If you understand why this happens, feel free to enlighten me. :)
var('x', real=True) should just work.
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #11 by Vinzent.Steinberg:
I changed your patch to let var() use the same syntax like symbols()
(except for
'xy')). Odd things happen:
>>> from sympy import *
>>> var('x', real=True)
x
>>> x.is_real
>
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #14 by ondrej.certik:
Sure. Apply this patch:
$ git di
diff --git a/sympy/core/symbol.py b/sympy/core/symbol.py
index 5e3f134..1e2e266 100644
--- a/sympy/core/symbol.py
+++ b/sympy/core/symbol.py
@@ -2
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #15 by Vinzent.Steinberg:
Added tests and changed single_character_names to each_char (dedicated to
ease of
typing). Trigger new behavior if space or comma in string.
For details, see patch descripti
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #17 by Vinzent.Steinberg:
Of course; it's my fault because I forgot to check doctests. Thank you!
Issue attribute updates:
Status: Fixed
--
You received this message because you are listed i
Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169
Comment #16 by ondrej.certik:
Nice patch, only I committed this on top of it, because it fails doctests:
$ git di
diff --git a/sympy/core/symbol.py b/sympy/core/symbol.py
index e34793d..49a23ae 100644
--- a/sy
18 matches
Mail list logo