diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2020-10-29 10:11:06 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2020-10-29 10:11:06 +0000 |
commit | 48a9a519cc7a4d52ff85577efee0048350d07254 (patch) | |
tree | f92b16ae72a142e8f3fd5d3fb0d696afcfc07708 /numpy/f2py | |
parent | ff26a55e7855f24f065714253fdc5de1c0df9eab (diff) | |
download | numpy-48a9a519cc7a4d52ff85577efee0048350d07254.tar.gz |
DOC: f2py: Add a docstring for getarrlen
The API of this function is awful, and I still have no idea what it does.
Maybe someone reading the docstring will be able to work it out.
Diffstat (limited to 'numpy/f2py')
-rwxr-xr-x | numpy/f2py/crackfortran.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index 1fe2ca037..2e95e4596 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -2187,6 +2187,37 @@ _varname_match = re.compile(r'\A[a-z]\w*\Z').match def getarrlen(dl, args, star='*'): + """ + Parameters + ---------- + dl : sequence of two str objects + dimensions of the array + args : Iterable[str] + symbols used in the expression + star : Any + unused + + Returns + ------- + expr : str + Some numeric expression as a string + arg : Optional[str] + If understood, the argument from `args` present in `expr` + expr2 : Optional[str] + If understood, an expression fragment that should be used as + ``"(%s%s".format(something, expr2)``. + + Examples + -------- + >>> getarrlen(['10*x + 20', '40*x'], {'x'}) + ('30 * x - 19', 'x', '+19)/(30)') + >>> getarrlen(['1', '10*x + 20'], {'x'}) + ('10 * x + 20', 'x', '-20)/(10)') + >>> getarrlen(['10*x + 20', '1'], {'x'}) + ('-10 * x - 18', 'x', '+18)/(-10)') + >>> getarrlen(['20', '1'], {'x'}) + ('-18', None, None) + """ edl = [] try: edl.append(myeval(dl[0], {}, {})) |