#18887: LineString array method (property) returns different data type without and with NumPy installed -------------------------------------+------------------------------------- Reporter: mal | Owner: Ubercore Type: Bug | Status: assigned Component: GIS | Version: 1.4 Severity: Normal | Resolution: Keywords: GIS, NumPy, | Triage Stage: Ready for LineString | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Adam DePrince <deprince@…>): No, this doesn't capture what is really happening. There is a bug with this: [(0.0, 0.0), (3.0, 3.0)] =! array( 0., 0.],[ 3., 3.?) This snippet doesn't mean {{ not ([(0.0, 0.0), (3.0, 3.0)] =! array( 0., 0.],[ 3., 3.?)) }} it means these types are completely incomparable. If you compare these two you get completely different behavior than if you compared two lists. numpy.array([(0.0, 0.0), (3.0, 3.0)]) == [(0.0, 0.0), (3.0, 3.0)] array([[ True, True], [ True, True]], dtype=bool There will be two populations that use this API. One will have numpy installed on their dev machines and one won't. When they release extensions and share code those they share it with may not have the same numpy status. It seems pretty clear that if you want a list you should call list(LineString(...)) and if you actually want a numpy array you could call .array and expect it. If the system will silently break that promise you should have an exception, but we don't want to break existing code, so I'm proposing we raise a warning instead. This diff doesn't do this. My proposed code does. We can't have two APIs that depend on the module you have installed; I really feel strongly that .array without numpy installed should warn. -- Ticket URL: <https://code.djangoproject.com/ticket/18887#comment:12> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.