remove solve todo
This commit is contained in:
parent
9dd42d2151
commit
1352f90f7d
@ -8,7 +8,6 @@ class Stack(object):
|
||||
"""Docstring for Stack """
|
||||
|
||||
def __init__(self):
|
||||
"""@todo: to be defined1 """
|
||||
self.items = []
|
||||
|
||||
def pushFromList(self, list):
|
||||
@ -21,7 +20,6 @@ class Stack(object):
|
||||
|
||||
def isEmpty(self):
|
||||
""" Says if the stack is empty
|
||||
:returns: @todo
|
||||
|
||||
"""
|
||||
return self.items == []
|
||||
@ -29,9 +27,6 @@ class Stack(object):
|
||||
def push(self, item):
|
||||
"""Push an item in the stack
|
||||
|
||||
:param item: @todo
|
||||
:returns: @todo
|
||||
|
||||
"""
|
||||
self.items.append(item)
|
||||
|
||||
|
@ -116,7 +116,6 @@ class Operator(str):
|
||||
:*args: Operands for this operation
|
||||
:returns: list with the operator surrounded by operands
|
||||
|
||||
# TODO: order doctest |lun. nov. 24 07:17:29 CET 2014
|
||||
>>> op.mul.__p2i__(1,2)
|
||||
[1, '*', 2]
|
||||
>>> f = save_mainOp([2, op.add, 3],op.add)
|
||||
@ -131,9 +130,7 @@ class Operator(str):
|
||||
>>> op.sub1.__p2i__(f)
|
||||
['-', '(', 2, '+', 3, ')']
|
||||
"""
|
||||
# TODO: Attention à gestion des fractions qui se comportent chelou avec les parenthèses |dim. nov. 9 09:21:52 CET 2014
|
||||
if self.arity == 1:
|
||||
# TODO: Marche juste avec -, il faudra voir quand il y aura d'autres operateurs unitaires |dim. nov. 9 09:24:53 CET 2014
|
||||
op1 = self.l_parenthesis(args[0])
|
||||
ans = flatten_list([self, op1])
|
||||
|
||||
@ -165,7 +162,6 @@ class Operator(str):
|
||||
|
||||
def r_parenthesis(self, op, str_join=False):
|
||||
""" Add parenthesis for rigth operand if necessary """
|
||||
# TODO: /!\ Parenthèses pour -2abc et l'opérateur * |lun. mars 9 19:02:32 CET 2015
|
||||
try:
|
||||
if op.mainOp.priority < self.priority:
|
||||
op = flatten_list(["(", op, ")"])
|
||||
|
@ -77,11 +77,12 @@ if __name__ == '__main__':
|
||||
from itertools import permutations
|
||||
from pymath import Polynom
|
||||
from pymath import Expression
|
||||
from pymath import Fraction
|
||||
coefs_p = [[(i-2),(j-2)] for i,j in permutations(range(5),2)]
|
||||
coefs_q = [[2*(i-2),2*(j-2)] for i,j in permutations(range(5),2)]
|
||||
l_p = [Polynom(i) for i in coefs_p]
|
||||
l_q = [Polynom(i) for i in coefs_q]
|
||||
operations = [Expression([l_p[i],l_q[j],op.pw]) for i,j in permutations(range(len(coefs_p)),2)]
|
||||
l_q = [Fraction(i,j) for i,j in coefs_q if j!=0]
|
||||
operations = [Expression([l_p[i],l_q[j],op.mul]) for i,j in permutations(range(len(l_q)),2)]
|
||||
for i in operations:
|
||||
print(i)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user