David Turner <[EMAIL PROTECTED]> added the comment:

> FWIW, I see exposing bytecodes as an anti-pattern that locks in a
> particular implementation in a way that makes it hard to change and 
> hard to port to other Python implementations.  The current bound 
> method approach works fine.  Don't really see enough payoff to 
> justify the extra code and maintenance.
Bytecodes aren't exposed at the language level -- just during
compilation.  As far as I know, other implementations don't use any of
the Python compiler mechanics, so there's no portability problem.  If
another compiler did use the Python AST, they could just compile the
Append node kind to a method call with no loss of speed or clarity.  Or
they could just not use this optimization, if we refactor the ast
optimizer as I propose to use the strategy pattern.

As for the payoff, microbenchmarks show a big win.  Also, appending to a
list is a fairly common pattern.  Our Plone-based codebase shows tens of
thousands of instances of append.

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4264>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to