PR 14966: Adding a new argument to np.asfarray
![](https://secure.gravatar.com/avatar/6f1e0a1c41913d3a2cc3cfe6b7260e91.jpg?s=120&d=mm&r=g)
Hi, I've submitted PR #14966, which makes a couple of small, backward compatible, changes to the API of `asfarray`: 1. Added `copy` parameter that defaults to `False` 2. Added `None` option to the `dtype` parameter Item #1 is inspired by situations like the one in Stack Overflow question https://stackoverflow.com/q/58998475/2988730. Sometimes, you just need to ensure a copy, and it's nice not to have to check things like if `asfarray(x) is x: x = x.copy()`. Item #2 solves the problem of trying to do `asfarray(x, dtype=x.dtype)` for `x` that don't have a `dtype` attribute, like lists or tuples. I've made every effort to make `dtype` and `copy` play together nicely. On an unrelated note, I've also submitted #14967 to clean up the internals of `mintypecode` a little in the same file. Regards, - Joe
participants (1)
-
Joseph Fox-Rabinovitz