[Zope-dev] Re: SVN: Zope/trunk/lib/python/OFS/Traversable.py using startswith()

Florent Guillaume fg at nuxeo.com
Tue Feb 28 12:23:30 EST 2006


Why? x[0] is much faster than x.startswith().
Or do you expect to have empty path components?

Florent

Andreas Jung wrote:
> Log message for revision 65598:
>   using startswith()  
> 
> -=-
> Modified: Zope/trunk/lib/python/OFS/Traversable.py
> ===================================================================
> --- Zope/trunk/lib/python/OFS/Traversable.py	2006-02-28 16:59:49 UTC (rev 65597)
> +++ Zope/trunk/lib/python/OFS/Traversable.py	2006-02-28 17:17:12 UTC (rev 65598)
> @@ -173,7 +173,7 @@
>                  name = path_pop()
>                  __traceback_info__ = path, name
>  
> -                if name[0] == '_':
> +                if name.startswith('_'):
>                      # Never allowed in a URL.
>                      raise NotFound, name
>  
> 
> 


-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope-Dev mailing list