0

I've been playing around with namedtuples from collections in classes, and came across this simpler 'syntactic sugar' naming assignment, but when I assign foo to 009 and try to put it into the tuple it doesn't work. Am I simple, or can someone explain to me this is borken, and the snakes will not eat me for missing the obvious?

foo = 999
#foo = 009

var = main, x, y, z, a = 'this', 10, 9, 8, foo

print('content: ', var)
print(main)
print(a, x, y, z)
Tim Pozza
  • 498
  • 6
  • 9

2 Answers2

1

You are unable to create an int starting with 0. If you wish to create an int that is the equivalent of 9, you should just write foo = 9.

0 as a prefix is used for special cases such as 0x<number> for hexadecimal and 0o<number> for octal integers.

Tim Pozza
  • 498
  • 6
  • 9
Bharel
  • 23,672
  • 5
  • 40
  • 80
0

Just don't make foo = 009 because python doesn't support that. Try this:

foo = 999
foo = 9

var = main, x, y, z, a = 'this', 10, 9, 8, foo

print('content: ', var)
print(main)
print(a, x, y, z)