[PyQt] Method overloading with nested lists in PyQt5
Matthias Kuhn
matthias at opengis.ch
Fri May 13 15:05:16 BST 2016
Hi,
While updating to PyQt5 (and python3) I am experiencing an issue with
overloaded methods where one overload takes a list of items and another
overload takes a list of a list of items.
When called with a list of a list of items, a TypeError is produced
warning that "index 0 has type 'list' but 'item' is expected.
It seems that the first overload for a "list of something" is found and
when "something" doesn't match, no different list overloads are tried
which might still be of type "list of something else".
This works fine with PyQt4. Does this ring a bell for someone?
Here a short (handwritten) example of the situation.
Regards
Matthias
----------------------------------
class Point
{
double x;
double y;
};
typedef QVector<Point> Line;
typedef QVector<Line> Polygon; // Can contain multiple rings for holes
class Geometry
{
static bool compare(const Point&, const Point&); // Point
static bool compare(const Line&, const Line&); // QVector<Point>
static bool compare(const Polygon&, const Polygon&); //
QVector<QVector<Point> >
}
>> Geometry.compare( [[Point(1,1), Point(2,2,)]], [[Point(1,1),
Point(2,2)]] )
TypeError: index 0 has type 'list' but 'Point' is expected
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160513/d70c7dff/attachment.html>
More information about the PyQt
mailing list