Data attributes...

Martin von Loewis loewis at informatik.hu-berlin.de
Thu Jan 24 20:23:46 CET 2002


Lawrence Oluyede <rhymes at myself.com> writes:

> The tut says:
> 
> "Data attributes need not be declared; like local variables, they
> spring into existence when they are first assigned to"
> 
> Why that?

Python does not have declarations. Many people view that as an
advantage, since having to declare variables before first use (or
perhaps even after first use?) requires a lot of boilerplate code that
contributes little to the meaning of the program.

If you have accepted that you don't have to declare local variables in
a function (it isn't clear from your article whether you have): Why
would you require to declare instance attributes?

Regards,
Martin



More information about the Python-list mailing list