syntax_spaces.py 405 B

123456789101112131415161718
  1. """
  2. categories: Syntax,Spaces
  3. description: uPy requires spaces between literal numbers and keywords, CPy doesn't
  4. cause: Unknown
  5. workaround: Unknown
  6. """
  7. try:
  8. print(eval('1and 0'))
  9. except SyntaxError:
  10. print('Should have worked')
  11. try:
  12. print(eval('1or 0'))
  13. except SyntaxError:
  14. print('Should have worked')
  15. try:
  16. print(eval('1if 1else 0'))
  17. except SyntaxError:
  18. print('Should have worked')