[issue4199] add shorthand global and nonlocal statements

2013-06-30 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Closing and rejecting based on said discussion. 
http://mail.python.org/pipermail/python-dev/2013-June/127143.html

--
nosy: +gregory.p.smith
resolution:  - rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2013-06-29 Thread A.M. Kuchling

A.M. Kuchling added the comment:

Bumping version to 3.4.  I'll send a note to python-dev about this issue.

--
versions: +Python 3.4 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2012-03-15 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

+1 on the feature as described in the PEP.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2012-03-14 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

We could also just decide we don't need it :)

If we do (I haven't read the PEP) does a statement with an assignment make the 
variable global in that scope, or does it only affect the global variable for 
the duration of the assignment, and otherwise the variable remains local in the 
scope?  (I don't know which to guess, and the ambiguity is disturbing.  I like 
the current clarity even if it is more typing.)

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2012-03-14 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-07-24 Thread Ronald Oussoren

Changes by Ronald Oussoren ronaldousso...@mac.com:


--
versions: +Python 3.3 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-07-18 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I'm not sure as to the status of this.  Could it go back to (say) 3.3, is it 
still a candidate for 3.2(.x), or what?

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-07-18 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

2010/7/18 Mark Lawrence rep...@bugs.python.org:

 Mark Lawrence breamore...@yahoo.co.uk added the comment:

 I'm not sure as to the status of this.  Could it go back to (say) 3.3, is it 
 still a candidate for 3.2(.x), or what?

It can't do anything until 3.3.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-02-27 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

I do think a brief discussion after the moratorium is over would be good.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-02-24 Thread Jeremy Hylton

Jeremy Hylton jer...@alum.mit.edu added the comment:

I guess there's some question about whether the syntax in the PEP was
considered carefully when it was approved.  If so, I'm not sure that
we want to re-open the discussion.  On the other hand, it's been a
long time since the PEP was approved and we do have a moratorium on
language changes, so it doesn't hurt to slow things down.

I'd argue that the intent of the PEP is pretty clear.  You can take
any assignment statement where the LHS doesn't have subscripts, put a
nonlocal or global in front of it, and it means that all those
assignments are to global/nonlocal variables.

Jeremy

On Wed, Feb 24, 2010 at 4:20 AM, Georg Brandl rep...@bugs.python.org wrote:

 Georg Brandl ge...@python.org added the comment:

 I also notice that the Grammar in the PEP is more complicated:
 nonlocal_stmt ::=
     nonlocal identifier (, identifier)*
                [= (target_list =)+ expression_list]
   | nonlocal identifier augop expression_list

 The Grammar in the patch is:
 +global_stmt: 'global' NAME (',' NAME)* [','] ['=' testlist]
 +nonlocal_stmt: 'nonlocal' NAME (',' NAME)* [','] ['=' testlist]

 It appears that the PEP is trying to support:

 nonlocal x = y = z = 1
 nonlocal a, b = c, d = 1

 It also tries to support augmented assignment; however I'm not sure what the 
 semantics of that should be.

 Further, there is an ambiguity if too much freedom is allowed: what about

   global x = 1, y

 Is it declaring a global x and assigning a tuple, or declaring a global x 
 and a global y?

 If we're going to support the PEP as written, I think we need to
 modify Global() and Nonlocal() to look exactly like Assign(), but add
 an extra check to verify that all of the expressions in the targets
 are Name, List, or Tuple.  You'd probably want to check this at the
 time you are generating the AST, so that you're not stuck with some
 extra state in the compiler traversal about whether you are generating
 code for a Global() or an Assign().

 I would not support List or Tuple as targets.  Same basic problem as
 above, and I don't see a use case.

 I see two possibilities for the actual syntax:

 1) global *either* supports multiple identifiers, *or* one identifier
 and an assignment.

 2) global always supports multiple identifiers, each with an optional
 assignment; tuples need parentheses.

 In both cases, I would keep it simple and not allow multiple targets or
 augmented assignment.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue4199
 ___


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-02-23 Thread Jeremy Hylton

Jeremy Hylton jer...@alum.mit.edu added the comment:

Is deferred blocker a higher priority?

Jeremy

On Tue, Feb 23, 2010 at 4:37 PM, Georg Brandl rep...@bugs.python.org wrote:

 Georg Brandl ge...@python.org added the comment:

 High is not high enough :)

 --
 priority: high - deferred blocker

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue4199
 ___


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-02-23 Thread Jeremy Hylton

Jeremy Hylton jer...@alum.mit.edu added the comment:

On Sat, Dec 6, 2008 at 1:28 PM, Benjamin Peterson
rep...@bugs.python.org wrote:

 Benjamin Peterson musiccomposit...@gmail.com added the comment:

 I think I may have been merging add_ast_fields when I wrote the patch.

 Here's a new patch that handles global x, = (5,). To do it, I added a
 new flag* to the Global and Nonlocal AST objects that indicates whether
 the value needs to be unpacked or not.

You shouldn't need to do this.  The unpack is implied if the number of
identifiers is greater than 1.

Jeremy

 * The flag is an int. The bool AST type was removed in py3k.

 Added file: http://bugs.python.org/file12254/global_nonlocal_shorthand2.patch

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue4199
 ___
 ___
 Python-bugs-list mailing list
 Unsubscribe: 
 http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu



--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: [issue4199] add shorthand global and nonlocal statements

2010-02-23 Thread Jeremy Hylton
I also notice that the Grammar in the PEP is more complicated:
nonlocal_stmt ::=
nonlocal identifier (, identifier)*
   [= (target_list =)+ expression_list]
  | nonlocal identifier augop expression_list

The Grammar in the patch is:
+global_stmt: 'global' NAME (',' NAME)* [','] ['=' testlist]
+nonlocal_stmt: 'nonlocal' NAME (',' NAME)* [','] ['=' testlist]

It appears that the PEP is trying to support:

nonlocal x = y = z = 1
nonlocal a, b = c, d = 1

If we're going to support the PEP as written, I think we need to
modify Global() and Nonlocal() to look exactly like Assign(), but add
an extra check to verify that all of the expressions in the targets
are Name, List, or Tuple.  You'd probably want to check this at the
time you are generating the AST, so that you're not stuck with some
extra state in the compiler traversal about whether you are generating
code for a Global() or an Assign().

This approach makes the compiler code very simple.  We use exactly the
same code for Global(), Nonlocal(), and Assign().  It does have the
downside that you need to enforce this unwritten constraint of the AST
in ast.c and in the ast module.

It also means that the AST will change in a non-backwards compatible
way.  I don't see how to do that given that we're also changing the
language spec.  (Do you want to include the spec change in your
patch?)

Jeremy

On Tue, Feb 23, 2010 at 6:41 PM, Jeremy Hylton jer...@alum.mit.edu wrote:
 On Sat, Dec 6, 2008 at 1:28 PM, Benjamin Peterson
 rep...@bugs.python.org wrote:

 Benjamin Peterson musiccomposit...@gmail.com added the comment:

 I think I may have been merging add_ast_fields when I wrote the patch.

 Here's a new patch that handles global x, = (5,). To do it, I added a
 new flag* to the Global and Nonlocal AST objects that indicates whether
 the value needs to be unpacked or not.

 You shouldn't need to do this.  The unpack is implied if the number of
 identifiers is greater than 1.

 Jeremy



 * The flag is an int. The bool AST type was removed in py3k.

 Added file: http://bugs.python.org/file12254/global_nonlocal_shorthand2.patch

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue4199
 ___
 ___
 Python-bugs-list mailing list
 Unsubscribe: 
 http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu



___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2010-02-21 Thread A.M. Kuchling

A.M. Kuchling li...@amk.ca added the comment:

Bumping priority so this doesn't get forgotten before 3.2; it seems important 
because it fixes noncompliance with a PEP.

--
nosy: +akuchling
priority: normal - high

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2009-11-04 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
priority: critical - normal

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2009-06-04 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Postponed to 3.2.

--
nosy: +georg.brandl
versions: +Python 3.2 -Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2009-03-31 Thread Jeremy Hylton

Changes by Jeremy Hylton jer...@alum.mit.edu:


--
nosy: +jhylton

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2008-12-07 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
priority: high - critical

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2008-12-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

- the add_ast_fields() function seems to be added by this patch, but it 
is already in svn.

- Are 1-tuple supported?

t = [1]
global a, = t

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2008-12-06 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

I think I may have been merging add_ast_fields when I wrote the patch.

Here's a new patch that handles global x, = (5,). To do it, I added a
new flag* to the Global and Nonlocal AST objects that indicates whether
the value needs to be unpacked or not.

* The flag is an int. The bool AST type was removed in py3k.

Added file: http://bugs.python.org/file12254/global_nonlocal_shorthand2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2008-12-05 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Please review.

--
keywords: +needs review
stage:  - patch review
type:  - feature request

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2008-10-24 Thread Benjamin Peterson

New submission from Benjamin Peterson [EMAIL PROTECTED]:

PEP 3104 says that the nonlocal and global statements should allow a
shorthand. (global x; x = 3 == global x = 3) This patch implements that.

--
components: Interpreter Core
files: global_nonlocal_short_assign.patch
keywords: patch
messages: 75193
nosy: benjamin.peterson
priority: high
severity: normal
status: open
title: add shorthand global and nonlocal statements
versions: Python 3.1
Added file: http://bugs.python.org/file11880/global_nonlocal_short_assign.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4199] add shorthand global and nonlocal statements

2008-10-24 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


Removed file: 
http://bugs.python.org/file11880/global_nonlocal_short_assign.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4199
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com