> On Jul 22, 2018, at 8:48 AM, Sharan Basappa <sharan.basa...@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.

I would disagree that it is universally considered good practice to declare 
everything at the front. (There is much disagreement on this, but most consider 
declare at first use to be preferred, where possible).

Last century, C code required this to make things easier on the compiler, and 
some code bases and examples go back that far, so they use that method out of 
inertia.  
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to