phylanx
phylanx copied to clipboard
Can't use function in argument to "for in"
This code fails with a KeyError.
from phylanx import Phylanx
@Phylanx
def arr():
return [1,2,3]
@Phylanx
def use_arr():
for a in arr():
print(a)
use_arr()
However, simply moving the arr() function out of the loop causes it to work
from phylanx import Phylanx
@Phylanx
def arr():
return [1,2,3]
@Phylanx
def use_arr():
f = arr()
for a in f:
print(a)
use_arr()
@rtohid yet another problem that could use your expertise. Would you be able to have a look?
Currently, functions as iteration spaces are not supported, except for range and prange:
https://github.com/STEllAR-GROUP/phylanx/blob/ee2487275ad5b653ad0e5fae1e882a0f4404c6a5/python/phylanx/ast/physl.py#L955
I'm working on a cleaner way to generate and analyze code, https://github.com/rtohid/phyflow/blob/refactor/flow/ir/base.py.