How to read source code of python?

Benjamin Kaplan benjamin.kaplan at case.edu
Thu Jun 10 01:54:01 EDT 2010


On Wed, Jun 9, 2010 at 10:25 PM, Qijing Li <qjing.li at gmail.com> wrote:
> Thanks for your reply.
> I'm trying to understand python language deeply and  use it efficiently.
> For example: How the operator "in" works on list? the running time is
> be O(n)?  if my list is sorted, what the running time would be?
>
>

Still O(n). Python doesn't know that your list is sorted, so nothing
changes. And the check to make sure it is sorted would be O(n) anyway.



More information about the Python-list mailing list