<div dir="ltr">A slightly related question. For my SIP generator, I'm working on partially-automated %MappedType support for QMap/QList/Q<otherstuff> and also fixed size arrays (1D for now, maybe more later). For the fixed size arrays, I'm looking for input on how to represent them in Python, i.e. as tuples or lists. My instinct is to go with tuples, but would be interested to hear other ideas.<br><br>Also, I see the SIP5 roadmap talks about fixed array support: what is the plan there?<br><br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 2 February 2017 at 19:31, Cody Scott <span dir="ltr"><<a href="mailto:cody@perspexis.com" target="_blank">cody@perspexis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I wouldn't worry about breaking compatibility. I'd be surprised if people are actually passing Python tuples to Qt, since they don't come across as a list and it is easy enough to convert to a list before passing the value to Qt. And surely if they do now come across as a list then that would be better (though might require a small code change).<div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 2, 2017 at 12:12 PM, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 2 Feb 2017, at 5:02 pm, Russell Warren <<a href="mailto:russ@perspexis.com" target="_blank">russ@perspexis.com</a>> wrote:<br>
><br>
> Conversions are implemented only if there is a direct equivalent, everything else gets converted to a PyQt_PyObject. You could perhaps make the case for the date/time types.<br>
><br>
> datetime definitely might be nice, but the one I'd more likely want to make a case for is tuples.  I'm having to make some changes to deal with that now.<br>
><br>
> The issue is that if a dict is converted to a QVariant and sent to QML, any tuples in the dict hierarchy aren't getting converted properly since PyQt is leaving them as `PyQt_PyObject`, which QML obviously has no clue what to do with.  Right now I'm trying to determine the best way to deal with this... might require recursively searching such dicts for tuples and converting to lists prior to shipping to QML as a `QVariant`.  If PyQt converted tuples into `QVariantList` there would no need for this.<br>
><br>
> Is there a reason tuples don't get translated to QVariantList, just like lists do? Immutability concerns, maybe?<br>
><br>
> Also, fwiw, python `bytes` could also potentially translate to `QByteArray`.  Never used that (I'm fairly new to Qt), but it seems equivalent at least. It also isn't in the Qt->QML translation table [1], so is of less interest.<br>
<br>
</span>The reason for both is that I want conversions to be symmetrical. I'm not sure why I want that, other than it feels right. In any event any sort of change would break compatibility.<br>
<div class="m_-9198588331014719851HOEnZb"><div class="m_-9198588331014719851h5"><br>
Phil<br>
______________________________<wbr>_________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing<wbr>.com/mailman/listinfo/pyqt</a></div></div></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a><br></blockquote></div><br></div>