How naive (in the sense that compiler people use the term)
is the current Python system?  For example:

        def foo() :
            s = "This is a test"
            return(s)

         s2 = foo()

How many times does the string get copied?

Or, for example:

         s1 = "Test1"
        s2 = "Test2"
        s3 = "Test3"
        s = s1 + s2 + s3

Any redundant copies performed, or is that case optimized?

How about this?

        kcount = 1000
        s = ''
        for i in range(kcount) :
            s += str(i) + ' '

Is this O(N) or O(N^2) because of recopying of "s"?

I just want a sense of what's unusually inefficient in the
current implementation.  Thanks.

                                John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to