diff Python/compile.c @ 16638:79568c0d3e77 legacy-trunk

Change temp names created by listcomps from [%d] to _[%d], so the one-liner [k for k in dir() if k[0] != "_"] can be used to get the non-private names (used to contain "[1]").
author Tim Peters <tim.peters@gmail.com>
date Sat, 17 Feb 2001 05:30:26 +0000
parents 2c6417ef4628
children 1a5a441772ff
line wrap: on
line diff
--- a/Python/compile.c	Sat Feb 17 04:48:41 2001 +0000
+++ b/Python/compile.c	Sat Feb 17 05:30:26 2001 +0000
@@ -1309,7 +1309,7 @@
 {
 	/* listmaker: test list_for */
 	char tmpname[12];
-	sprintf(tmpname, "[%d]", ++c->c_tmpname);
+	sprintf(tmpname, "_[%d]", ++c->c_tmpname);
 	com_addoparg(c, BUILD_LIST, 0);
 	com_addbyte(c, DUP_TOP); /* leave the result on the stack */
 	com_push(c, 2);
@@ -4689,7 +4689,7 @@
 {
 	char tmpname[12];
 
-	sprintf(tmpname, "[%d]", ++st->st_tmpname);
+	sprintf(tmpname, "_[%d]", ++st->st_tmpname);
 	symtable_add_def(st, tmpname, DEF_LOCAL);
 	symtable_assign(st, CHILD(n, 1), 0);
 	symtable_node(st, CHILD(n, 3));