Repository: vaexio/vaex

Issue:
[BUG-REPORT] Cannot pass dictionaries into registered functions
Thank you for reaching out and helping us improve Vaex!

Before you submit a new Issue, please read through the [documentation](https://docs.vaex.io/en/latest/). Also, make sure you search through the Open and Closed Issues - your problem may already be discussed or addressed.

**Description**
If you pass a dictionary into a registered function, you get a syntax error, while the same works for a list.

```
import vaex
df = vaex.example()
df = df[df["id"] < 10][:100]

labels = {0:"now", 1: "happy", 2: "sad", 3:"arg", 4:"foo", 5:"bar", 6:"something", 7:"is", 8:"happening", 9:"here"}

@vaex.register_function()
def index_to_label(arr, mapping):
    return np.array([mapping[i] for i in arr])


df.id.index_to_label(labels)
```
throws
```
Expression = index_to_label(id, {0: 'now', 1: 'happy', 2: 'sad', 3: 'a...
Length: 100 dtype: string (expression)
--------------------------------------
Error evaluating: SyntaxError('invalid syntax', ('<unknown>', 1, 30, "index_to_label(id, {0: 'now' 1: 'happy' 2: 'sad' 3: 'arg' 4: 'foo' 5: 'bar' 6: 'something' 7: 'is' 8: 'happening' 9: 'here'})\n"))
```

while the same works as a list
```
import vaex
import numpy as np
df = vaex.example()
df = df[df["id"] < 10][:100]

labels = {0:"now", 1: "happy", 2: "sad", 3:"arg", 4:"foo", 5:"bar", 6:"something", 7:"is", 8:"happening", 9:"here"}
labels_list = [labels[i] for i in labels]
@vaex.register_function()
def index_to_label(arr, mapping):
    return np.array([labels[i] for i in arr])


df.id.index_to_label(labels_list)
```

I also tried to be explicit like the docs
```
import vaex
import numpy as np
import json
df = vaex.example()
df = df[df["id"] < 10][:100]

labels = {0:"now", 1: "happy", 2: "sad", 3:"arg", 4:"foo", 5:"bar", 6:"something", 7:"is", 8:"happening", 9:"here"}

@vaex.register_function(on_expression=False)
def index_to_label(mapping, arr):
    return np.array([mapping.get(i) for i in arr])


df.func.index_to_label(labels, df.id)
```

but that also failed


**Software information**
 - Vaex version (`import vaex; vaex.__version__)`: 4.9.1
 - Vaex was installed via: pip / conda-forge / from source  pip
 - OS:Mac/Linux



Discussion:

Resolving patch:
diff --git a/packages/vaex-core/vaex/expresso.py b/packages/vaex-core/vaex/expresso.py
--- a/packages/vaex-core/vaex/expresso.py
+++ b/packages/vaex-core/vaex/expresso.py
@@ -366,7 +366,7 @@ def visit_Dict(self, node):
             key = self.visit(key)
             value = self.visit(value)
             parts.append(f'{key}: {value}')
-        return '{' + ' '.join(parts) + '}'
+        return '{' + ', '.join(parts) + '}'
 
     def visit_Call(self, node):
         args = [self.visit(k) for k in node.args]


Test patch:
diff --git a/tests/expresso_test.py b/tests/expresso_test.py
--- a/tests/expresso_test.py
+++ b/tests/expresso_test.py
@@ -63,7 +63,7 @@ def test_lists():
     assert expr == expr_translate
 
 def test_dicts():
-    expr = "fillmissing(o, {'a': 1})"
+    expr = "fillmissing(o, {'a': 1, 'b': 2})"
     validate_expression(expr, {'o'}, {'fillmissing'})
     node = parse_expression(expr)
     assert node is not None