Replies: 8 comments 27 replies
-
cc: @yguclu |
Beta Was this translation helpful? Give feedback.
-
Do you think that you can avoid all need to know the type in advance (ie. while printing) via |
Beta Was this translation helpful? Give feedback.
-
Am I right in saying that the proposed implementation could never handle a list containing class instances? |
Beta Was this translation helpful? Give feedback.
-
Don't forget that we want to support similar things in the different languages that we translate to. Fortran is a lot less flexible than C (that's one of the reasons why it's often faster), do you have any thoughts about whether it's possible to implement what you propose in Fortran? |
Beta Was this translation helpful? Give feedback.
-
Have you thought about how you would implement functions such as abs ? E.g: a = [1,2,3,4,5,6,7,8,9]
i = 0
while i < a.size:
if a%2==0:
a.pop(i)
else:
a[i] = abs(a[i])
# long calculations using other functions that change depending on the type
i += 1 Would this be translated to a while loop with a very large number of if blocks? What is the cost of this vs only allowing homogeneous lists? |
Beta Was this translation helpful? Give feedback.
-
okay yes, I see the problem with heterogeneous list. |
Beta Was this translation helpful? Give feedback.
-
We have been considering another approach but we don't know if it might be better then implementing our own library. We came to the idea that we can use the cpython library and it's functions to create and manipulate the lists. For example, to create a list we can use |
Beta Was this translation helpful? Give feedback.
-
+1 on this in general. TBH homogeneous lists implemented as dynamic arrays would be more needed. For C there are quite a few libraries that could be used (see e.g. this overview), not sure about Fortran. |
Beta Was this translation helpful? Give feedback.
-
At the moment PythonList class does nothing except inherit from the PythonTuple class, we want to implement lists in Pyccel, we thought that we should at least try to implement heterogeneous lists. so far we thought of this implimentation:
@aihya @MostafaMamouni @EmilyBourne
Beta Was this translation helpful? Give feedback.
All reactions