[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-11 Thread Mark Dickinson
Changes by Mark Dickinson : -- stage: -> resolved ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-11 Thread Mark Dickinson
Mark Dickinson added the comment: Sergey: thanks for the response. Closing. -- status: open -> closed ___ Python tracker ___ ___ Pyth

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-11 Thread Sergey Litvinov
Sergey Litvinov added the comment: mark.dickinson> do you have an example of the Lib/bisect.py code No. I was thinking about something hypothetical similar to the one you provided. rhettinger> The "textbook" formula is more important in languages rhettinger> without something like Python long i

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: I agree with Mark. This code is *very* old and AFAICT it has never caused a problem in practice. The "textbook" formula is more important in languages without something like Python long ints. In Python, "textbook" form just slows down and obfuscates t

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-09 Thread Mark Dickinson
Changes by Mark Dickinson : -- resolution: -> not a bug status: open -> pending versions: +Python 3.4 -Python 3.6 ___ Python tracker ___

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-09 Thread Mark Dickinson
Mark Dickinson added the comment: Sergey: do you have an example of the Lib/bisect.py code causing problems in real (non-contrived) code? If not, I'd suggest closing this report as "not a bug". -- ___ Python tracker

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-08 Thread Mark Dickinson
Mark Dickinson added the comment: > What troubles? Well, I imagine that something like "bisect(a, 155, lo=numpy.uint8(0), hi=numpy.uint8(254))" would be asking for trouble. But (a) it's hard to imagine why anyone would want to do that given that NumPy has its own bisection code, and (b) you'

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What troubles? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-07 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +mark.dickinson, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-07 Thread Sergey Litvinov
New submission from Sergey Litvinov: Bisection algorithms use mid = (lo+hi)//2 Textbook formula is mid = (hi-lo)//2 + lo See http://en.wikipedia.org/w/index.php?title=Binary_search_algorithm&oldid=634658510#Arithmetic For "vanilla" lists and integers it is not a problem but one can run into tr