0

Why does the : syntax not work on linux

On MacOS

→ python3
Python 3.6.3 (default, Oct  4 2017, 06:09:38) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x : str = "hello"
>>> 

On Linux

→ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x : str = "hello"
  File "<stdin>", line 1
    x : str = "hello"
      ^
SyntaxError: invalid syntax
>>> 
2
  • What makes you think the OS has anything to do with what version of Python you have installed? Commented Jan 9, 2018 at 3:57
  • I've 3.5.2 and I can't get it to work on MacOS.. seems like it is something to do with the version of python Commented Jan 9, 2018 at 4:00

2 Answers 2

2

It is the problem with the python version. Try the same with 3.6 in linux.

Sign up to request clarification or add additional context in comments.

Comments

1

Its the version of python that is causing this. Update to 3.6 on Linux as well. Check release notes

Whats new in 3.6

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.