[GRASS-dev] [GRASS GIS] #2441: Underscore to avoid Python keywords used improperly in grass.script

GRASS GIS trac at osgeo.org
Sat Oct 4 08:50:25 PDT 2014


#2441: Underscore to avoid Python keywords used improperly in grass.script
-------------------------------------------+--------------------------------
 Reporter:  wenzeslaus                     |       Owner:  grass-dev@…              
     Type:  defect                         |      Status:  new                      
 Priority:  normal                         |   Milestone:  7.0.0                    
Component:  Default                        |     Version:  svn-trunk                
 Keywords:  PEP8, python keywords, parser  |    Platform:  Unspecified              
      Cpu:  Unspecified                    |  
-------------------------------------------+--------------------------------

Comment(by glynn):

 Replying to [ticket:2441 wenzeslaus]:

 > The code which will change is in grass.script.core and will look like
 this:
 >
 {{{
             if opt.startswith('_'):
                 opt = opt[1:]
             elif opt.endswith('_'):
                 opt = opt[:-1]
 }}}

 No objections, although `opt = opt.strip('_')` would probably suffice.
 GRASS option names will never start or end with an underscore.

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



More information about the grass-dev mailing list