Re: Python and Javascript equivalence

2007-04-23 Thread Sam the Cat
>> >> I am writing some COM code in Python to control photoshop. Several >> functions of PS require an "Array" argument. In the examples of VBscript >> or javascript the Array type is used. I have tried what would appear to >> be the equivalent in Python -- Lists and Tuples -- but to no avail

Re: Python and Javascript equivalence

2007-04-23 Thread Steve Holden
Sam the Cat wrote: > Hey All, > > I am writing some COM code in Python to control photoshop. Several > functions of PS require an "Array" argument. In the examples of VBscript or > javascript the Array type is used. I have tried what would appear to be the > equivalent in Python -- Lists and

Re: Python and Javascript equivalence

2007-04-23 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Prateek wrote: > Try creating a dict with sequential numeric keys. > > If you already have a list called my_list, you can do: > > com_array = dict(zip(range(len(my_list)), my_list)) com_array = dict(enumerate(my_list)) That doesn't create the intermediate lists. Ciao,

Re: Python and Javascript equivalence

2007-04-22 Thread 7stud
On Apr 22, 7:00 pm, "Sam the Cat" <[EMAIL PROTECTED]> wrote: > Hey All, > > I am writing some COM code in Python to control photoshop. Several > functions of PS require an "Array" argument. In the examples of VBscript or > javascript the Array type is used. I have tried what would appear to be t

Re: Python and Javascript equivalence

2007-04-22 Thread Prateek
Try creating a dict with sequential numeric keys. If you already have a list called my_list, you can do: com_array = dict(zip(range(len(my_list)), my_list)) This works when you want to convert Python objects to Javascript using JSON. It may work for you. -Prateek -- http://mail.python.org/ma

Python and Javascript equivalence

2007-04-22 Thread Sam the Cat
Hey All, I am writing some COM code in Python to control photoshop. Several functions of PS require an "Array" argument. In the examples of VBscript or javascript the Array type is used. I have tried what would appear to be the equivalent in Python -- Lists and Tuples -- but to no avail. An