Skip to main content
7 events
when toggle format what by license comment
Jul 15, 2014 at 21:57 comment added sotrh It's good to know about this module. I wrote my code as a mock which I'll use to write the java equivalent
Jul 15, 2014 at 21:55 vote accept sotrh
Jul 15, 2014 at 21:53 comment added jcollado @sotrh Correct. As pointed out by the documentation bisect.insort_left is equivalent to a.insert(bisect.bisect_left(a, x, lo, hi), x)
Jul 15, 2014 at 21:43 comment added sotrh So basically insort_left and bisect_left do the same thing except insort_left inserts x into the list while bisect_left just returns where it should be inserted?
Jul 15, 2014 at 21:34 comment added jcollado @sotrh Yes, that's the code in python 2.7.6 stdlib. Note that // is floor division whose behavior is consistent in python 2 and 3, but regular / doesn't behave the same way. More information here.
Jul 15, 2014 at 19:36 comment added sotrh Is this the code used by the module? (I never knew about the // operator, that's cool)
Jul 15, 2014 at 19:01 history answered jcollado CC BY-SA 3.0