Wrapping statements in Python in SPSS

Chris Angelico rosuav at gmail.com
Fri Dec 28 11:10:10 EST 2012


On Sat, Dec 29, 2012 at 3:01 AM,  <alankrinsky at gmail.com> wrote:
> I am working with Python looping in SPSS. What are the limits for the
>
> for var1, var2, var3 in zip(Variable1, Variable2, Variable3):
>
> statement in the Python looping function within SPSS? I am getting an error message, I presume because of wrapping or length. Imagine the above statement, but expanded, as I am working with more than 28 variables in this loop, and even making the names really short is making the statement too long. Is it impossible to wrap and make this work? I know there are ways to wrap strings, including lists of variables, but here I have a statement/function.

At what point are you wrapping it? Can you show the wrapped form and
the error message?

As a general rule, you can safely wrap anything that's inside parentheses.

for (
  var1,
  var2,
  var3
) in zip(
  Variable1,
  Variable2,
  Variable3
):
  pass

That may be a tad excessive, but you get the idea :)

ChrisA



More information about the Python-list mailing list