multi-arg append (was RE: will python 3000 break my code?)

Tim Peters tim_one at email.msn.com
Thu Mar 2 00:03:31 EST 2000


[Daniel Berlin and Fredrik Lundh, fighting]

[/F]
>     3. be impossible to identify by automatic tools.
>     Tim's excellent checkappend.py can spot many
>     cases, but not all.

The module docstring warns about these cases, btw (in case anyone is
wondering).

Here's an observation which leads to a question:  while I've found many
dozens of instances of multi-arg append, I have yet to find the first where
the (unfindable by checkappend.py) bound method flavor is actually called
with multiple arguments.  That is, while people-- whether by design or
accident I'm unsure --have done

    list.append(1, 2, 3)

depressingly often, for whatever reason I haven't yet seen anyone do

    push = list.append
    ...
    push(1, 2, 3)

or

    apply(list.append, some_tuple_with_len_not_equal_to_1)

or any other of the "subtle" spellings.

Now for the question:  has anyone else <wink>?  That is, in my experience so
far, checkappend.py has found all the cases that were actually broken
(verfied by running the fixed code under a Python fiddled to raise an
exception on multi-arg append).

> ...
> calling professional programmers idiots is not okay.

That really depends on the professional programmer in question, right?  For
example, I enjoy being called an idiot.

it's-amusing!-ly y'rs  - tim






More information about the Python-list mailing list