[py-dev] adding env option to xspec (initialy posted to [execnet-dev])

Antonio Cuni anto.cuni at gmail.com
Fri Jun 25 17:58:25 CEST 2010


On 25/06/10 16:41, holger krekel wrote:
>> >  +    def env(self):
>> >  +        return [(env.lstrip('env:'), value)
>> >  +                    for env, value in  self.gateway.spec.__dict__.iteritems()
>> >  +                    if env.startswith('env:')]
>> >

> You could use env[4:] instead of lstrip() to optimize though :)


using [:4] instead of lstrip is not much about performance, but about correctness:

 >>> 'env:env'.lstrip('env:')
''

ciao,
Anto



More information about the Pytest-dev mailing list