Skip to content
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

Multiple inputs/outputs for "Python Script" #2324

Closed
borondics opened this issue May 18, 2017 · 5 comments
Closed

Multiple inputs/outputs for "Python Script" #2324

borondics opened this issue May 18, 2017 · 5 comments
Assignees

Comments

@borondics
Copy link
Member

Orange version

3.4.dev0+1b1813c

Expected behavior

Often times it would be extremely useful to be able to connect several inputs to the Python Script widget and be able to do operations with them to generate one or multiple outputs.

Would it be possible to have in_data and out_data as an array and handle arbitrary number of inputs/outputs? (Or at least for the input part, because I see how outputting an array can confuse other widget functionality)

Actual behavior

Python Script accepts only one input and provides one output channel.

@borondics borondics changed the title Multiple input for "Python Script" Multiple inputs/outputs for "Python Script" May 18, 2017
@janezd
Copy link
Contributor

janezd commented May 18, 2017

This wouldn't be difficult to implement, but we have to decide what it will look like.

The natural way to access multiple data sets would be by indexing, e.g. in_data[0], in_data[1]... If we do so, we break compatibility with the existing code where in_data[0] used to be the first data instance.

We could let in_data be the Table, if there is just one, or a list of tables, if there are multiple. This wouldn't work well for scripts that can accept multiple tables but also work with just a single table.

One solution may be to have in_data.get_token(i), which returns the i-th table (we should come up with a better name than get_token. If there is just one signal, in_data would still contain the table, but also have a get_token method. If there are multiple signals, in_data without get_token would be ... hm, what?

The technical implementation of this is not very clean, but it would work.

@jschueller
Copy link
Contributor

hi, news on this ?

@jerneju jerneju added the easy label Jun 21, 2017
@jerneju jerneju self-assigned this Jun 21, 2017
@janezd
Copy link
Contributor

janezd commented Jun 23, 2017

@jerneju started working on it in #2418, but the current PR breaks compatibility with existing code. What about this option:

  • in_data contains the table if there is exactly one; None otherwise
  • multi_data is a list of tables; it can be empty, have a single table or multiple tables.

This solution doesn't require monkey-patching (like get_token above), and it supports scripts that expect a single table, as well as scripts that accept multiple tables but can work with one.

@janezd
Copy link
Contributor

janezd commented Jun 23, 2017

I'm sorry, I'm stupid. That's what's essentially already in #2418.

@kernc
Copy link
Contributor

kernc commented Oct 11, 2017

Fixed in #2506.

@kernc kernc closed this as completed Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants