I generally avoid wildcard imports. Two additional reasons not to use them:
- When you use the wildcard form it is harder for other people (and for yourself in the future) to know just what it is that you are actually importing. As such, debugging eventual errors takes more time. - wildcard imports also increase the chance of having name clashes and of hiding functions with identical names. Em 10/05/2017 20:38, "Raymond Nijssen" <r.nijs...@terglobo.nl> escreveu: > Hi Calvin, > > Here are some thoughts on python imports: > > https://www.python.org/dev/peps/pep-0008/#imports > > The last paragraph is about using wildcards. > > Raymond > > On 10-05-17 20:03, C Hamilton wrote: > >> I am wondering how important it is to import the modules separately. >> Such as: >> >> from qgis.core import QGis, QgsCoordinateTransform, QgsRectangle, >> QgsPoint, QgsGeometry >> >> Does it really make a difference? I am finding that you have to make >> sure every part of your code is exercised so that nothing was missed. By >> doing the above there is more of a chance to have a bug. Perhaps for >> PyQt4.QtGui it makes sense, but there is less chance to have a python >> error if you keep. >> >> from qgis.core import * >> from PyQt4.QtGui import * >> from qgis.gui import * >> >> Thoughts? >> >> Thanks, >> >> Calvin >> >> >> >> On Wed, May 10, 2017 at 12:00 PM, Luigi Pirelli <lui...@gmail.com >> <mailto:lui...@gmail.com>> wrote: >> >> this is a slide about plugin porting I'll be presenting to the next >> spanish foss4g: >> http://slides.com/luigipirelli/desdarrolloplugindeqgis-xi-girona#/17 >> <http://slides.com/luigipirelli/desdarrolloplugindeqgis-xi-girona#/17 >> > >> sorry it's in spanish >> >> about >> >> from PyQt4 import QtGui >> >> or >> >> from PyQt4.QtGui import QDialog >> >> I would prefer the second so to avoid to postpone lib version errors >> at pyc time and not at runtime. >> it make it simpler to mock or alias a class globally if you need >> >> regards >> Luigi Pirelli >> >> ************************************************************ >> ************************************** >> * Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com >> * LinkedIn: https://www.linkedin.com/in/luigipirelli >> <https://www.linkedin.com/in/luigipirelli> >> * Stackexchange: >> http://gis.stackexchange.com/users/19667/luigi-pirelli >> <http://gis.stackexchange.com/users/19667/luigi-pirelli> >> * GitHub: https://github.com/luipir >> * Mastering QGIS 2nd Edition: >> * >> https://www.packtpub.com/big-data-and-business-intelligence/ >> mastering-qgis-second-edition >> <https://www.packtpub.com/big-data-and-business-intelligence >> /mastering-qgis-second-edition> >> ************************************************************ >> ************************************** >> >> >> >> _______________________________________________ >> QGIS-Developer mailing list >> QGIS-Developer@lists.osgeo.org >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer >> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer >> >> > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer