2

I am migrating to python 3, (from python 2)

seed = 5L
model = ALS.train(trainingRDD, rank, seed=seed, iterations=iterations,
                  lambda_=regularizationParameter)

and the first line of the code above returns invalid syntax error. How should I tune it in Python 3? The error is:

SyntaxError: invalid syntax
  File "<command-2039439267792266>", line 6
    seed = 5L
            ^
SyntaxError: invalid syntax
Giorgos Myrianthous
  • 36,235
  • 20
  • 134
  • 156
Elm662
  • 663
  • 1
  • 5
  • 18
  • 1
    Thanks! I think the answer below is what you need then! Python 3 only has a single int type, they dropped the "long int" and combined. – mgrollins Jul 12 '19 at 23:20
  • Possible duplicate of [Long Int literal - Invalid Syntax?](https://stackoverflow.com/questions/24249519/long-int-literal-invalid-syntax) – pault Jul 15 '19 at 15:01

1 Answers1

2

You just need remove L

seed = 5

Python 3.X integers support unlimited size in contrast to Python 2.X that has a separate type for long integers.

Giorgos Myrianthous
  • 36,235
  • 20
  • 134
  • 156