-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when return iterable with one element #10
Comments
Hi Simon, To solve this problem (Python has exactly the same ambiguity), you have to return a tuple of one element: Add a coma at the end of your expression |
I want return the iterable itself
Ok, thanks that works ! So, it's still a limitation/problem to wrap external code (= not modifiable) who return iterable with one element ? It is resolvable ? |
In Python to create a tuple with one element, you have to do: We have exactly the same problem and there is no simple solution |
Ok, but the thing a don't understand, I return a dict not a tuple. Even with a defaultdict, list or numpy array.
So openalea can't transform/wrap (=make a node) correctly a iterable with one element if they not return like a tuple of one element. It's still a huge limitation, scikit-image, scikit-learn, opencv, etc. don't return systematically (even practically never) their numpy_array/list/dict like a tuple of one element. |
So, more, I try "the tuple of one element" solution. But I don't understood that changed my type of return during the python execution.
Through visualea return the list |
In fact, in visualea, the default behavior is several outputs.
In our case, list, tuple, dict are considered as iterable.
(1) is not similar to (1,) Possible solutions
|
Hi, I encounter problem :
test_bug_3()
bug and return :Worst with a collection.defaultdict like :
don't throw error; just return a empty dict {}
Same for you ?
The text was updated successfully, but these errors were encountered: