[issue4327] Patch: simplify complex constant assignment statements

2010-08-27 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree. A programmer who mashes a = d = 1 b, c = e = 2, 3 into one statement deserves the bytecode he gets ;-). -- nosy: +terry.reedy ___ Python tracker __

[issue4327] Patch: simplify complex constant assignment statements

2010-08-21 Thread Georg Brandl
Georg Brandl added the comment: I'm going to reject this; it adds a whole lot of code for optimizing very a minor usecase. -- nosy: +georg.brandl resolution: -> rejected status: open -> closed ___ Python tracker

[issue4327] Patch: simplify complex constant assignment statements

2008-11-24 Thread David Turner
David Turner <[EMAIL PROTECTED]> added the comment: Everything in optimize.c is about modifying the AST (this is on tlee's ast optimization branch, in case I didn't mention earlier). Also, changing asdl_seq_SET would be a bad idea, since it is used for sequences of things other than stmt_tys.

[issue4327] Patch: simplify complex constant assignment statements

2008-11-24 Thread Jeremy Hylton
Jeremy Hylton <[EMAIL PROTECTED]> added the comment: I haven't thought about the code in a while, but what code that modifies the AST are we worried about? There are lots of modifications in ast.c, since it is being created there. The case we really care about is sequences, where we want to mod

[issue4327] Patch: simplify complex constant assignment statements

2008-11-24 Thread David Turner
David Turner <[EMAIL PROTECTED]> added the comment: Sure, but that's an even bigger change. Every piece of code which modifies the AST would now also have to modify parent pointers. Having the pointers would make many things easier, but I didn't want to make a very invasive change like that wit

Re: [issue4327] Patch: simplify complex constant assignment statements

2008-11-24 Thread Jeremy Hylton
On Mon, Nov 24, 2008 at 12:14 PM, David Turner <[EMAIL PROTECTED]> wrote: > > David Turner <[EMAIL PROTECTED]> added the comment: > > jhylton, keep in mind that this would require an additional "parent" > argument to each function which takes a stmt. Do you think this added > complexity is worth i

[issue4327] Patch: simplify complex constant assignment statements

2008-11-24 Thread David Turner
David Turner <[EMAIL PROTECTED]> added the comment: jhylton, keep in mind that this would require an additional "parent" argument to each function which takes a stmt. Do you think this added complexity is worth it? ___ Python tracker <[EMAIL PROTECTED]>

[issue4327] Patch: simplify complex constant assignment statements

2008-11-24 Thread Jeremy Hylton
Jeremy Hylton <[EMAIL PROTECTED]> added the comment: It seems generally useful to have a helper function to replace a range of nodes in a sequence of statements with another sequence of nodes. A general API like that would allow you to insert or delete nodes as well as replacing one node with a

[issue4327] Patch: simplify complex constant assignment statements

2008-11-14 Thread David Turner
David Turner <[EMAIL PROTECTED]> added the comment: Oh, and this also involved the creation of an additional statement type, unfortunately. The statement type, Seq, represents a sequence of statements. This is so that we can replace a single assign with multiple assigns. If that's no good, then

[issue4327] Patch: simplify complex constant assignment statements

2008-11-14 Thread David Turner
New submission from David Turner <[EMAIL PROTECTED]>: This patch adds functionality to the optimizer to simplify complex constant assignments like: a, (b, c) = d, e = 1, (2, 3) The simplification is: a = 1 d = 1 b, c = e = 2, 3 Of course, the simplified version is semantically identical. But