[sympy] Fixing Issue 3576: symbols('aa:g') should work (#1706)

9 views
Skip to first unread message

Marek Šuppa

unread,
Dec 30, 2012, 3:39:46 AM12/30/12
to sympy/sympy

This pull request implements new behavior of symbols function, e.g.:

In [1]: symbols('aa:d')
Out[1]: (aa, ab, ac, ad)

A simple test is also provided.

The original issue: http://code.google.com/p/sympy/issues/detail?id=3576 also suggests some other features that might be worth implementing. I think that deserves new pull requests.


You can merge this Pull Request by running:

  git pull https://github.com/mrshu/sympy symbols

Or view, comment on, or merge it at:

  https://github.com/sympy/sympy/pull/1706

Commit Summary

  • implemented symbols('aa:z')
  • added test for new symbols feature

File Changes

  • M sympy/core/symbol.py (17)
  • M sympy/core/tests/test_symbol.py (8)

Patch Links


Reply to this email directly or view it on GitHub.

Aaron Meurer

unread,
Dec 30, 2012, 4:33:53 PM12/30/12
to sympy/sympy

SymPy Bot Summary: :red_circle: Failed after merging mrshu/symbols (0c60e01) into master (c3e9d56).
@mrshu: Please fix the test failures.
:red_circle:Python 2.5.0-final-0: fail
:red_circle:Python 2.6.6-final-0: fail
:red_circle:Python 2.7.2-final-0: fail
:eight_spoked_asterisk:Python 2.6.8-final-0: pass
:eight_spoked_asterisk:Python 2.7.3-final-0: pass
:eight_spoked_asterisk:PyPy 2.0.0-beta-1; 2.7.3-final-42: pass
:eight_spoked_asterisk:Python 3.2.2-final-0: pass
:eight_spoked_asterisk:Python 3.3.0-final-0: pass
:eight_spoked_asterisk:Python 3.2.3-final-0: pass
:eight_spoked_asterisk:Python 3.3.0-final-0: pass
:eight_spoked_asterisk:Python 3.3.0-final-0: pass
:eight_spoked_asterisk:**Sphinx 1.1.3:** pass

Marek Šuppa

unread,
Dec 30, 2012, 5:36:39 PM12/30/12
to sympy/sympy

I'm not sure if this is normal situation here but I believe those tests doesn't fail because of my commit.

Aaron Meurer

unread,
Dec 30, 2012, 7:27:31 PM12/30/12
to sympy/sympy

No, that's just Pyglet acting up again.

Aaron Meurer

unread,
Dec 31, 2012, 3:55:22 PM12/31/12
to sympy/sympy

Well, you went with a pretty specific instance of something that I think should be much more general. See the issue for what I am talking about. For example, neither a1a:g nor aa:gg work. Ideally, there would be just one regular expression to match all cases (or two, one for uppercase and one for lowercase). It's not that complicated: letter1:letter2 should be matched, where letter1 and letter2 are a single alphabetic letters of the same case.

By the way, symbols("A:g") works and gives something strange. This is why there should be separate cases for uppercase and lowercase.

Marek Šuppa

unread,
Jan 1, 2013, 2:26:46 PM1/1/13
to sympy/sympy

Thanks for comments!

Both a1a:g and aa:gg should now work. I am not sure if I got the point with aa:gg but it should now generate (aag, abg, acg, adg, aeg, afg, agg).

Also, if the first argument is uppercase and the second lowercase an empty tuple is returned.

Aaron Meurer

unread,
Jan 1, 2013, 7:21:05 PM1/1/13
to sympy/sympy

This looks much better.

Aaron Meurer

unread,
Jan 2, 2013, 5:37:37 AM1/2/13
to sympy/sympy

SymPy Bot Summary: :eight_spoked_asterisk: Passed after merging mrshu/symbols (f910c1f) into master (c3e9d56).
:eight_spoked_asterisk:Python 2.5.0-final-0: pass
:eight_spoked_asterisk:Python 2.6.6-final-0: pass
:eight_spoked_asterisk:Python 2.7.2-final-0: pass


:eight_spoked_asterisk:Python 2.6.8-final-0: pass
:eight_spoked_asterisk:Python 2.7.3-final-0: pass
:eight_spoked_asterisk:PyPy 2.0.0-beta-1; 2.7.3-final-42: pass
:eight_spoked_asterisk:Python 3.2.2-final-0: pass
:eight_spoked_asterisk:Python 3.3.0-final-0: pass
:eight_spoked_asterisk:Python 3.2.3-final-0: pass
:eight_spoked_asterisk:Python 3.3.0-final-0: pass
:eight_spoked_asterisk:Python 3.3.0-final-0: pass

:eight_spoked_asterisk:Sphinx 1.1.3: pass

Aaron Meurer

unread,
Jan 2, 2013, 5:44:41 PM1/2/13
to sympy/sympy

Merging...

Aaron Meurer

unread,
Jan 2, 2013, 5:44:45 PM1/2/13
to sympy/sympy

Merged #1706.

Reply all
Reply to author
Forward
0 new messages