[Zope-dev] Fwd: Multi-argument append() is illegal
Martijn Pieters
mj@digicool.com
Fri, 3 Mar 2000 19:47:14 +0100
I wrote:
> > This will miss aliasing of
> > .append (app=list.append), which I hunted out with a separate regexp,
and
> > lines like:
> >
> > append(1 # number 1
> > ,2 # number 2
> >
> > which were again hunted (and none found) with another simple regexp. So
I am
> > fairly sure I got em all =).
And Tres Seaver <tseaver@palladion.com> then replied:
> The other thing to look out for is the "extra layer of indirection", where
> append is invoked through another name. For example::
>
> >>> foobar = []
> >>> push = foobar.append
> >>> push( 'foo', 'bar' )
> >>> foobar
> [('foo', 'bar')]
>
> This gets especially ugly if the bound method is passed as a "normal"
function
> pointer into some completely different scope, which might invoke it with
> arbitrary parameters.
That's what I ment by aliasing. I searched for all occurrences of:
\.[[:blank:]]*append[[:blank:]]*(#.*)?$
which will catch all references to the append method not being called. The
hits on that search then either used the proper 1 argument syntax or didn't
use tuples at all.
Martijn Pieters
| Software Engineer mailto:mj@digicool.com
| Digital Creations http://www.digicool.com/
| Creators of Zope http://www.zope.org/
| The Open Source Web Application Server
---------------------------------------------