Python Forum
i can use this statement as a variable name - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: i can use this statement as a variable name (/thread-11920.html)



i can use this statement as a variable name - Skaperen - Aug-01-2018

there is such a thing as an async statement. yet i can use async as a variable name. it is not a reserved word. how does that work?


RE: i can use this statement as a variable name - Larz60+ - Aug-01-2018

it will only work until you try to use the real async in the same scope


RE: i can use this statement as a variable name - ichabod801 - Aug-01-2018

Currently, it appears there are only 35 words you can't use as variable names. But, as Larz points out, that doesn't mean it's necessarily a good idea to use all the other words as variable names.


RE: i can use this statement as a variable name - Skaperen - Aug-01-2018

is there a list of all the other words that is a good idea to avoid?


RE: i can use this statement as a variable name - ichabod801 - Aug-01-2018

All the built-ins and all the standard modules?


RE: i can use this statement as a variable name - Skaperen - Aug-01-2018

just those and no more? can i use async?


RE: i can use this statement as a variable name - Larz60+ - Aug-01-2018

Just an FYI, a good IDE, such as VSCode will highlight 'reserved words' (old school).
It doesn't prevent you from using them, but makes you aware of the danger involved.