Benjamin Peterson <benja...@python.org> added the comment: 2011/2/3 Alexander Belopolsky <rep...@bugs.python.org>: > > Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment: > > On Thu, Feb 3, 2011 at 12:08 PM, Benjamin Peterson > <rep...@bugs.python.org> wrote: > .. >>> I wonder: Why ast nodes need to be mutable? >> >> So people can change them. > > Well, they are hashable, so this needs to be done carefully. Is this > necessary for AST-based optimizations? Does Python actually change > AST after it has been created? Note that for some optimizations it > may be more appropriate to build a new tree rather than mutate the old > one. Depending on the algorithm, you may or may not need to change > the nodes after they have been created in the process.
Other people are, though. The hash is by identity anyway. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11105> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com