Sorry, I just thought that:

if '>' in rawdata[j:]

would do a search, that is, that the implementation of "in" would just 
reuse/call the implementation of "find" and that the position returned would be 
used as:
-1: not in
!= -1: in
which seemed to me like the easy implementation of "in". That's why I was 
wondering why to search twice.


Now I realize that it doesn't work the way I thought. Thank you for showing me 
and sorry for the confusion.

Best regards,
Guido (another Guido ;-) )



----- Ursprüngliche Message -----
Von: Antoine Pitrou <solip...@pitrou.net>
An: python-dev@python.org
CC: 
Gesendet: 11:22 Dienstag, 12.Februar 2013
Betreff: Re: [Python-Dev] Question regarding: Lib/_markupbase.py

Le Mon, 11 Feb 2013 11:02:04 -0800,
Guido van Rossum <gu...@python.org> a écrit :
> Warning: see http://bugs.python.org/issue17170. Depending on the
> length of the string being scanned and the probability of finding the
> specific character, the proposed change could actually be a
> *pessimization*. OTOH if the character occurs many times, the slice
> will actually cause O(N**2) behavior. So yes, it depends greatly on
> the distribution of the input data.

That said, the savings are still puny unless you spend your time
calling str.find().

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/just_another_developer%40yahoo.de

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to