Python questions from C/Perl/Java programmer

Aahz Maruch aahz at netcom.com
Mon Jul 24 12:43:33 EDT 2000


In article <397C6F49.7BEBB207 at alabanza.net>, ye, wei <yw at alabanza.net> wrote:
>
>1. Why not use {}?!
>def f:
>    ...
>why not use {} like this:
>def f {
>    ...
>}

If you want the long answer, search DejaNews for "space tab".  Short
answer: it makes programs easier to read.  If you're concerned about
mixing tabs and spaces, use -tt on the Python command line.

After 1.5 years, I still find it annoying to use whitespace to indicate
program blocks (particularly when rearranging code), but I find the
readability more than compensates.  Note that many people here will tell
you to use an editor that makes this easier.

>2. Why variable doesn't have to be declared before use?

This usually ends up being less of a problem in Python because functions
and modules tend to be shorter.  But, yes, this is a concern that a lot
of people have; however, it probably will not get addressed soon.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Zie is so far from a clue that it would take a sub-light vessel several
years to reach one.  --Aahz



More information about the Python-list mailing list