[python-win32] Slow convert collection to list (search a fast way)

Tim Roberts timr at probo.com
Thu Feb 12 08:11:15 CET 2009


You wrote:
>
>Hi!
>
>I get a collection of (COM) objects:
>    tobj = oie.prepartableau(    #it's a JScript array of objects, returned 
>by a JScript function via COM
>I convert (translate? transtype?) this collection to LIST:
>    lobj = list(tobj)
>But it's (very) slow(*). I tried  [i for i in tobj] ; I tried with iter ; 
>with 'for' ; etc.  All is slow.
>(*) slow:  0.7 seconds for len=1000
>
>Who know a way for fast get the collection like LIST?

You think 700 microseconds for a COM transaction is slow?  Perhaps it is your expectations that need adjusting.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.


More information about the python-win32 mailing list