Skip to content

BUG, MAINT: concatenate of empty sequences, fixes #1586 #7450

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

Closed
wants to merge 1 commit into from

Conversation

jaimefrio
Copy link
Member

@jaimefrio jaimefrio commented Mar 22, 2016

(#1586)

Empty non-arrays no longer participate in determining the dtype of
the result.

Have also refactored the code quite a bit, unifying the flattened
and multidim branches wherever possible, as well as the error checks.
Also a handful of new tests, including both the bug fixed and
existing untested functionality.

@charris
Copy link
Member

charris commented Apr 1, 2016

Hmm... I'm wondering if this isn't one of those functions that would look better in Cython? We already have an _internal.py file and there has been discussion of gradually transitioning more parts of numpy to Cython, so I wonder if we couldn't set up a private _multiarray.py file and start moving some functions into it? We could then import using npy_cache_import. A concern might be speed, although there is the speed/maintainability tradeoff, but that question is worth settling at some point. Some more benchmarks would help with that.

@njsmith, @seberg Thoughts?

@seberg
Copy link
Member

seberg commented Apr 2, 2016

That would be a simple method of moving things to Cython, and I guess speed wise probably fine. I have difficulties to get an idea of how much this specific code would be simplified.

One thing that I always think could be very useful, would be if there was nditer/NpyIter aware code generation. The new iterator is pretty convoluted to set up, but I guess for that to be really useful, we have to trust fused types and I seem to remember there were some limitations to them, though maybe they are cleared up and I have used them before.

@seberg
Copy link
Member

seberg commented Apr 2, 2016

compiled_base.c might have some candidates as well.

@homu
Copy link
Contributor

homu commented Feb 21, 2017

☔ The latest upstream changes (presumably #8584) made this pull request unmergeable. Please resolve the merge conflicts.

Empty non-arrays no longer participate in determining the dtype of
the result.

Have also refactored the code quite a bit, unifying the flattened
and multidim branches wherever possible, as well as the error checks.
Also a handful of new tests, including both the bug fixed and
existing untested functionality.
@jaimefrio jaimefrio force-pushed the concatenate_empty branch from c950966 to 3b9f052 Compare April 3, 2017 19:37
@homu
Copy link
Contributor

homu commented Apr 5, 2017

☔ The latest upstream changes (presumably #8894) made this pull request unmergeable. Please resolve the merge conflicts.

@eric-wieser
Copy link
Member

Sorry to keep creating conflicts here!

Also, the commit message prefix is missing an I

@eric-wieser
Copy link
Member

What does this PR think about:

np.concatenate([np.array([], float), np.array([1, 2], int)]).dtype

I think we want the answer to be float64

@eric-wieser eric-wieser changed the title BUG, MANT: concatenate of empty sequences, fixes #1586 BUG, MAINT: concatenate of empty sequences, fixes #1586 Apr 7, 2017
@mattip
Copy link
Member

mattip commented Apr 30, 2019

Closing. The new tests pass except for Eric's comment about np.concatenate([np.array([], float), np.array([1, 2], int)]).dtype which in the PR expects int but produces float64.

Please reopen if it should be 'int

@mattip mattip closed this Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants