本文整理汇总了Python中mathics.core.expression.Expression.pattern_sequence方法的典型用法代码示例。如果您正苦于以下问题:Python Expression.pattern_sequence方法的具体用法?Python Expression.pattern_sequence怎么用?Python Expression.pattern_sequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mathics.core.expression.Expression
的用法示例。
在下文中一共展示了Expression.pattern_sequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_wrappings
# 需要导入模块: from mathics.core.expression import Expression [as 别名]
# 或者: from mathics.core.expression.Expression import pattern_sequence [as 别名]
def get_wrappings(self, yield_func, items, max_count, expression, attributes, include_flattened=True):
if len(items) == 1:
yield_func(items[0])
else:
if max_count is None or len(items) <= max_count:
if 'Orderless' in attributes:
for perm in permutations(items):
sequence = Expression('Sequence', *perm)
sequence.pattern_sequence = True
yield_func(sequence)
else:
sequence = Expression('Sequence', *items)
sequence.pattern_sequence = True
yield_func(sequence)
if 'Flat' in attributes and include_flattened:
yield_func(Expression(expression.get_head(), *items))