coding style - where to declare variables

Chris Angelico rosuav at gmail.com
Sun Jul 22 09:39:02 EDT 2018


On Sun, Jul 22, 2018 at 10:48 PM, Sharan Basappa
<sharan.basappa at gmail.com> wrote:
> In other programming languages (e.g. C, C++), as a good practice, variables are declared right at the start of the program, irrespective of where it is normally used. What is the practice in Python?
>
> I see that, most of the code, declare variables where it is used and not at the start of the program.

Common practice in Python is to never declare your variables, since
Python doesn't have variable declarations.

ChrisA


More information about the Python-list mailing list