FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Adds support to convert iterators to arrays by jmlidbetter · Pull Request #928 · pythonnet/pythonnet · GitHub

Repository navigation

Adds support to convert iterators to arrays - #928

Merged
filmor merged 1 commit into
pythonnet:masterfrom
jmlidbetter:iters_to_arrays
Aug 5, 2019
Merged

filmor merged 1 commit into
pythonnet:masterfrom
jmlidbetter:iters_to_arrays

Conversation

jmlidbetter commented Aug 1, 2019 •
edited
Loading

Copy link
Copy Markdown
Contributor

What does this implement/fix? Explain your changes.

Python 3 has much more liberal use of iterators, e.g. getting keys or values from a dictionary. This adds functionality to convert python object which support the iterator protocol to arrays in C#.

Does this close any currently open issues?

No

Any other comments?

N/A

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

jmlidbetter force-pushed the iters_to_arrays branch 2 times, most recently from 0bd4a10 to 2e51321 Compare August 2, 2019 07:47

filmor commented Aug 2, 2019

Copy link
Copy Markdown
Member

This looks like a good addition feature-wise, but there is quite a bit of duplicated code in it. I think it would be better if we had /one/ implementation based on the iterator protocol, that just uses an additional size hint if len is implemented.

Copy link
Copy Markdown
Contributor Author

This looks like a good addition feature-wise, but there is quite a bit of duplicated code in it. I think it would be better if we had /one/ implementation based on the iterator protocol, that just uses an additional size hint if len is implemented.

Sure. Presumably sequence protocol => iterator protocol?

filmor commented Aug 2, 2019

Copy link
Copy Markdown
Member

It says so in the docs: https://docs.python.org/2/library/stdtypes.html#iterator-types as well as https://docs.python.org/3/library/stdtypes.html#iterator-types:

Sequences [...] always support the iteration methods.

Copy link
Copy Markdown
Contributor Author

It says so in the docs: https://docs.python.org/2/library/stdtypes.html#iterator-types as well as https://docs.python.org/3/library/stdtypes.html#iterator-types:

Sequences [...] always support the iteration methods.

Ok, have redone - always uses iterator protocol now.

Cronan commented Aug 5, 2019

Copy link
Copy Markdown
Contributor

@filmor Passed!

filmor commented Aug 5, 2019

Copy link
Copy Markdown
Member

This looks great, thanks :)

filmor merged commit 51a1868 into pythonnet:master Aug 5, 2019
AlexCatarino pushed a commit to QuantConnect/pythonnet that referenced this pull request Jun 18, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL