+ 8

Why the walrus_operator ':=' cannot be used in 🐍 CCC, even though it works in 🐍 Playground⁉️🤔

Code Coach Challenge & Playground use the same version of 🐍: sys.version: 3.8.4 (default, Jul 14 2020, 03:07:46) [GCC 8.3.0] However, an attempt to use in the code a walrus_operator ':=' in 🐍 CCC generates an error & the message: The code: print('True' if (w := 'PALINDROME') == w[::-1] else 'False') The message: Using variable'walrus' before assignment Everything works fine in 🐍 Playground‼️😃👍

14th Oct 2020, 1:27 PM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
1 Answer
+ 2
Thats strange and interesting... I wonder if the CCC uses Pylint, theres a similar issue in Github. Nothings wrong with it but Pylint argues that it's wrong... https://github.com/PyCQA/pylint/issues/3347
20th Oct 2020, 2:20 PM
かんでん
かんでん - avatar