Miscellaneous

Miscellaneous stuff that doesn’t really fit anywhere else.

sympy.utilities.misc.debug(*args)[source]

Print *args if SYMPY_DEBUG is True, else do nothing.

sympy.utilities.misc.find_executable(executable, path=None)[source]

Try to find ‘executable’ in the directories listed in ‘path’ (a string listing directories separated by ‘os.pathsep’; defaults to os.environ[‘PATH’]). Returns the complete filename or None if not found

sympy.utilities.misc.rawlines(s)[source]

Return a cut-and-pastable string that, when printed, is equivalent to the input. The string returned is formatted so it can be indented nicely within tests; in some cases it is wrapped in the dedent function which has to be imported from textwrap.

Examples

Note: because there are characters in the examples below that need to be escaped because they are themselves within a triple quoted docstring, expressions below look more complicated than they would be if they were printed in an interpreter window.

>>> from sympy.utilities.misc import rawlines
>>> from sympy import TableForm
>>> s = str(TableForm([[1, 10]], headings=(None, ['a', 'bee'])))
>>> print rawlines(s) # the \ appears as \ when printed
(
    'a bee\n'
    '-----\n'
    '1 10 '
)
>>> print rawlines('''this
... that''')
dedent('''\
    this
    that''')
>>> print rawlines('''this
... that
... ''')
dedent('''\
    this
    that
    ''')
>>> s = """this
... is a triple '''
... """
>>> print rawlines(s)
dedent("""\
    this
    is a triple '''
    """)
>>> print rawlines('''this
... that
...     ''')
(
    'this\n'
    'that\n'
    '    '
)

Previous topic

Memoization

Next topic

PKGDATA

This Page