. Python 2.1 function attributes

Alex Martelli aleaxit at yahoo.com
Sun Jan 28 02:49:17 EST 2001


"Tim Peters" <tim.one at home.com> wrote in message
news:mailman.980660493.13036.python-list at python.org...
    [snip: the print>> botch]
> would-be-more-impressed-by-the-damnation-of-people-who've-actually-
>     tried-it-ly y'rs  - tim

Would you?  OK, assuming this is not just cheap rhetoric, then: I've tried
it and I damn it worse then ever.  Specifically, my son is learning Python
as a spare-time activity (age: 17, background: Pascal, some assembler),
and is loving it and finding it extremely impressive (he thinks of computers
as tools, not ends in themselves -- a trait he must have gotten from his
mother, I guess -- and he paid Python the highest possible compliment
when he said 'it gets out of my way and just lets me DO things').  Issues
that have given him problems so far, and resolutions of said issues:

a. undefined-variables: he somehow expected that an x+=1, if x had
    not been bound yet, would set x to 1; after reasoning about it he
    agreed that it was clearer to start by setting x=0 before the loop
    and AFAIK he doesn't do that mistake any more.

b. he keeps trying to use x.length() and slapping his forehead after
    getting the error and changing to len(x); still claims this makes no
    sense and that it SHOULD be a method, and not abbreviated, from
    what the rest of the language leads him to expect.

c. he keeps forgetting to end clauses with a colon ('else', etc); still
    grumbles that omitting that colon should be OK.

[No problem with / truncating, mixed-case issues, nor scoping -- all
things I _thought_ might give him problems given how Pascal does
it -- so I guess my preliminary explanations sufficed for those].

d. he thought print>>file would APPEND to the file object and never
    OVERWRITE it -- at least once tried writing 'print>file' for the
    latter purpose -- and I also heard him complain than then 'of
    course' input<file should also work.  Last I head he deemed it
    a 'total mess' and swore he'd stick with write/writelines for his
    file output needs.

I guess the unbiased opinions of a Python newbie don't count for
much, but, me, I was impressed that the 'print>>' made up 1/3
of the grand total of his objections to Python -- just about anything
else he took in stride and found to work just as expected (his two
other enduring objections, interestingly enough, are _also_ to
minor syntax-sugar issues -- and they don't look totally unfounded
to me, either).  It is of course possible that I subconsciously passed
my biases to him, but he's a pretty independent guy (and the fact
that he has no trouble with / truncating seems to confirm that).


Alex






More information about the Python-list mailing list