question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API: `asarray` API for `copy=...` kwarg

See original GitHub issue

There was a plan to update NumPy’s asarray’s copy kwarg, however, this would mismatch with the array one. NumPy was currently aiming for possibly having an enum or maybe copy="never", but not a False/True/None flags.

I am a bit unclear about the desired API right now, since on NumPy it was explicitly argued against the True/False/None choice.

@charris has also brought up the idea to add a “please do not copy this array” flag to the array object itself to prevent accidental copy of large arrays.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
shoyercommented, Jul 21, 2022

Yes, I was advocating for enums last time 🤦

I commented on the mailing list discussion advocating for True/False/None.

1reaction
shoyercommented, Jul 21, 2022

I think 3-way True/False/None is a totally reasonable solution if we are designing this API from scratch.

The problem is that right now copy=False means “copy if needed” for NumPy, which is not what we would want copy=False to mean in the array API.

If we want to change what copy=False means, we’ll need a deprecation cycle in NumPy. That would be somewhat distruptive, but on the whole, it might be a good thing – it would turn up lots of cases where users are probably mistaken about what copy=False means. Also this would a relatively smooth deprecation, because there’s an easy backwards compatible work-around (just set copy=None instead) and we would not be changing the behavior of existing code beyond starting to raise an error message in some cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Imageio's developer API — imageio 2.9.0 documentation
Pypy's np.asarray consumes a lot of memory if the given array is an ndarray ... If True, the file will be downloaded even...
Read more >
API: how to handle NA in conversion to numpy arrays #30038
In #29964 and #29961 NA in IntegerArray and BooleanArray), the question comes up how to handle pd.NA's in conversion to numpy arrays.
Read more >
Splat operators in JavaScript, equivalent to *args and ...
I use Python a lot, and I am just quickly learning JavaScript right now (or should I say re-learning). So, I wanted to...
Read more >
mediapy API documentation - Google
Package mediapy. mediapy : Read/write/show images and videos in an IPython/Jupyter notebook. [GitHub source] [API docs] [PyPI package] [Colab example].
Read more >
iarray.asarray — ironArray for Python 2022.3-$IA_BUILD_VER ...
iarray.asarray(obj: Union[IArray, bool, int, float, NestedSequence, Any], ... copy: Optional[bool] = None, cfg: Optional[Config] = None, **kwargs) → IArray ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found