[GRASS-dev] [GRASS GIS] #2067: PyGRASS grid calls g.region at import time

GRASS GIS trac at osgeo.org
Mon Sep 9 20:33:02 PDT 2013


#2067: PyGRASS grid calls g.region at import time
--------------------------+-------------------------------------------------
  Reporter:  huhabla      |       Owner:  grass-dev@…                                                                    
      Type:  defect       |      Status:  closed                                                                         
  Priority:  blocker      |   Milestone:  7.0.0                                                                          
 Component:  Python       |     Version:  svn-trunk                                                                      
Resolution:  fixed        |    Keywords:  wingrass, PyGRASS, Grid, Python, temporal framework, t.remove, t.rast.neighbors
  Platform:  MSWindows 7  |         Cpu:  Unspecified                                                                    
--------------------------+-------------------------------------------------

Comment(by glynn):

 Replying to [comment:4 zarch]:

 > We are only run the module with the --interface-description and then
 parsing the xml

 Even that is too work on import.

 An import should only execute function and class definitions, and variable
 assignments where the value is "simple": no potentially-large loops, no
 executing external commands, preferably no I/O (beyond other imports,
 although even those should be deferred for third-party modules which don't
 abide by these rules).

 Don't assume that importing your module implies that any of the
 functionality it provides will actually be used, let alone all of it. It's
 often the case that A imports B with intent to use some of its
 functionality, and B imports C because some other functionality provided
 by B depends upon C, but A never actually makes use of that so it
 shouldn't be paying a non-trivial price for it.

 Also, if a module is only used by a few functions, consider making the
 import local to the function(s) which actually use it, particularly for
 modules which have significant dependency trees and which are often
 otherwise unused.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2067#comment:5>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list