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

Added Identity function #61

Merged
merged 2 commits into from
Sep 7, 2020
Merged

Added Identity function #61

merged 2 commits into from
Sep 7, 2020

Conversation

VMRuiz
Copy link

@VMRuiz VMRuiz commented Sep 4, 2020

Added Identity Method to be able to return fixed values.

Is it quite common that sometimes with just need to return a fixed value.

@renancunha
Copy link
Contributor

Great feature 😃 @VMRuiz! During the schema conversion tests, we needed a feat like this one to fill a specific field with a fixed value.

I have just one consideration: maybe should we stick to the idea of always returns the iterable (with the result), instead of returning the result itself? By doing this we will keep all functions returning the same data structure. We had some discussion about the same situation at #23. In fact, the #23 aims to change the join pipe to follow this approach 👍.

@VMRuiz
Copy link
Author

VMRuiz commented Sep 4, 2020

Great feature @VMRuiz! During the schema conversion tests, we needed a feat like this one to fill a specific field with a fixed value.

I have just one consideration: maybe should we stick to the idea of always returns the iterable (with the result), instead of returning the result itself? By doing this we will keep all functions returning the same data structure. We had some discussion about the same situation at #23. In fact, the #23 aims to change the join pipe to follow this approach .

Hello @renancunha ,

I thought about this and I decided to allow the user to get either a single element identity(1) or a iterable identity((1,)) because there are others methods that don't return iterables like join , first, and all of the string methods.

However, I don't have anything agaisn't change it if you all think is better.

shublang/shublang.py Outdated Show resolved Hide resolved
Co-authored-by: Akshay Philar <[email protected]>
@VMRuiz VMRuiz merged commit dec1205 into master Sep 7, 2020
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

Successfully merging this pull request may close these issues.

3 participants