Speaking of Python and 6.0, I cannot get Python to show up as a
scripting option in XSI.
I have loaded 2.5 and pywin32 and ever ran the pyscript.py and had no
luck.
Any ideas? I am getting desperate.
Andre
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf
Of Bernard Lebel
Sent: April 13, 2007 1:13 PM
To: XSI(at)Softimage.COM
Subject: Re: creating lists in Python
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> Behalf Of Matt Estela
> myList = None * 4860
I don't know if it's a python 2.4 thing, but the approach quoted below
doesn't work at all for me. It raise this error:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
aList = [ None * 3 ]
does the same thing.
Now, if the intention of the example was something like
aList = [ None ] * 3
to give [ None, None, None ], I have to warn to be careful when doing
this. I used this approach to create particle arrays, and somehow ran
into problems later on. I never use it to create lists. Here is an
enlightening email from Patrick Boucher:
Bernard Lebel wrote:
> aArray = [ [] ] * iChannelCount
> # aArray looks like [ [], [], [] ]
This creates a list of three 'pointers' to the _same_ list (kinda / not
really but it's the easiest way to decribe it in a few words)
> aArray = [ [], [], [] ]
This creates a list of three distinct, seperate, different lists.
In the first code example you're basically accessing the same list
whether you're accessing aArray[0], aArray[1] or aArray[2]
Try the following in a python prompt for a demo:
>>> a = [[]] * 5
>>> a
[[], [], [], [], []]
>>> a[0].append(1)
>>> a
[[1], [1], [1], [1], [1]]
I don't think you can avoid doing:
aArray = []
for i in range(iChannelCount):
aArray.append([])
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi