pythonizer icon indicating copy to clipboard operation
pythonizer copied to clipboard

Arrays should be interpolated in strings

Open snoopyjc opened this issue 3 years ago • 2 comments

Arrays should be interpolated in strings, for example:

$s = "array is @array, hash is @{[%hash]}"

sets s to exactly that string - it should include the contents of array and hash.

snoopyjc avatar Nov 17 '21 05:11 snoopyjc

Generated code should be something like f"{' '.join(array)}", though ideally the ' ' should be the $" value. For the hash case: f"{' '.join(functools.reduce(lambda x,y:x+y, hash.items()))}"

snoopyjc avatar Nov 17 '21 06:11 snoopyjc

Fixed in https://github.com/snoopyjc/pythonizer

snoopyjc avatar Feb 07 '22 16:02 snoopyjc