Skip to content

Commit 0e88e3a

Browse files
committed
make is_uniform seteable from the context.
1 parent bcb1e5f commit 0e88e3a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mathics/core/expression.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,22 +1967,23 @@ def construct(elements):
19671967

19681968
# Note: this function is called a *lot* so it needs to be fast.
19691969
def convert_expression_elements(
1970-
elements: Iterable, conversion_fn: Callable = from_python
1970+
elements: Iterable, conversion_fn: Callable = from_python, is_uniform: bool = True
19711971
) -> Tuple[tuple, ElementsProperties, Optional[tuple]]:
19721972
"""
19731973
Convert and return tuple of Elements from the Python-like items in
19741974
`elements`, along with elements properties of the elements tuple,
19751975
and a tuple of literal values if it elements are all literal
19761976
otherwise, None.
1977+
By default, is is assumed that `elements` are *uniform*, which is the typical case
1978+
of elements coming from applying a numerical function to a set of different arguments.
19771979
19781980
The return information is suitable for use to the Expression() constructor.
19791981
19801982
"""
19811983

19821984
# All of the properties start out optimistic (True) and are reset when that
19831985
# proves wrong.
1984-
# Also, expressions from this function are expected to be uniform.
1985-
elements_properties = ElementsProperties(True, True, True, True)
1986+
elements_properties = ElementsProperties(True, True, True, is_uniform)
19861987

19871988
is_literal = True
19881989
values = [] # If is_literal, "values" contains the (Python) literal values

0 commit comments

Comments
 (0)