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

Jakub Gustak jgustak at gmail.com
Fri Jun 25 18:36:45 CEST 2010


>>> >  +    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:')
> ''

True, I somehow forgot strip removes chars not whole string.
_
jakub



More information about the Pytest-dev mailing list