qgis/QGIS-Documentation — pull request #191 by akbargumbira (2013-12-23 17:09:07+00:00)
Title: Some fixes to get the snippet code working

After reading and trying some snippet codes here, there are some invalid points:
1) QgsFeature.attributes() returns a list, not dictionary. So, this code:
``` attrs = feature.attributes() ```
will return a list, not a dictionary. From reading this (http://www.qgis.org/api/qgsfeature_8h_source.html), it makes sense: QgsFeature.attributes() returns QgsAttributes which is a QVector.
For the same reason, we can not do:
``` print feature.attributes()['name'] ```

2) Get rid of QVariant constructor as the consequence of SIP API changes. This code:
``` attrs = { 0 : QVariant("hello"), 1 : QVariant(123) } ```
will raise an error: "TypeError: PyQt4.QtCore.QVariant represents a mapped type and cannot be instantiated"