Re: [Python-Dev] Unbound locals in class scopes

2015-06-23 Thread Ivan Levkivskyi
On 23 June 2015 at 05:33, Nick Coghlan wrote: > > > Also, since classes inside functions are commonly used in unit tests (at > > least mine :-), I worry that *any* changes in this behavior might break > > working code (no matter how much that "working" could be considered an > > accident, it's st

Re: [Python-Dev] Unbound locals in class scopes

2015-06-22 Thread Nick Coghlan
On 22 June 2015 at 17:13, Guido van Rossum wrote: > But what *is* the correct behavior? I suspect people's intuitions differ. If > you think of this as similar to function scopes you're likely to be wrong. For me, there's a correct answer for *new* users based on the combination of: 1. For modul

Re: [Python-Dev] Unbound locals in class scopes

2015-06-22 Thread Guido van Rossum
On Mon, Jun 22, 2015 at 3:03 AM, Nick Coghlan wrote: > On 22 June 2015 at 08:46, Ivan Levkivskyi wrote: > > > > > > On 21 June 2015 at 22:05, Guido van Rossum wrote: > >> > >> On Sun, Jun 21, 2015 at 6:22 PM, Ivan Levkivskyi > >> wrote: > >>> > >>> It is still not clear whether Guido's comment

Re: [Python-Dev] Unbound locals in class scopes

2015-06-21 Thread Nick Coghlan
On 22 June 2015 at 08:46, Ivan Levkivskyi wrote: > > > On 21 June 2015 at 22:05, Guido van Rossum wrote: >> >> On Sun, Jun 21, 2015 at 6:22 PM, Ivan Levkivskyi >> wrote: >>> >>> It is still not clear whether Guido's comment still stands for not >>> raising an UnboundLocalError in class definitio

Re: [Python-Dev] Unbound locals in class scopes

2015-06-21 Thread Ivan Levkivskyi
On 21 June 2015 at 22:05, Guido van Rossum wrote: > > On Sun, Jun 21, 2015 at 6:22 PM, Ivan Levkivskyi wrote: >> >> It is still not clear whether Guido's comment still stands for not raising an UnboundLocalError in class definitions but using globals instead. > > > Can you phrase this in the form

Re: [Python-Dev] Unbound locals in class scopes

2015-06-21 Thread Guido van Rossum
On Sun, Jun 21, 2015 at 6:22 PM, Ivan Levkivskyi wrote: > It is still not clear whether Guido's comment still stands for not raising > an UnboundLocalError in class definitions but using globals instead. > Can you phrase this in the form of an example, showing what it currently does and what you

Re: [Python-Dev] Unbound locals in class scopes

2015-06-21 Thread Ivan Levkivskyi
On 20 June 2015 at 18:39, Ron Adam wrote: > > > On 06/20/2015 12:12 PM, Ron Adam wrote: > >> >> >> On 06/20/2015 02:51 AM, Ivan Levkivskyi wrote: >> > > Guido said 13 years ago that this behavior should not be changed: >>> https://mail.python.org/pipermail/python-dev/2002-April/023428.html, >>>

Re: [Python-Dev] Unbound locals in class scopes

2015-06-20 Thread Ron Adam
On 06/20/2015 12:12 PM, Ron Adam wrote: On 06/20/2015 02:51 AM, Ivan Levkivskyi wrote: Guido said 13 years ago that this behavior should not be changed: https://mail.python.org/pipermail/python-dev/2002-April/023428.html, however, things changed a bit in Python 3.4 with the introduction of

Re: [Python-Dev] Unbound locals in class scopes

2015-06-20 Thread Ron Adam
On 06/20/2015 02:51 AM, Ivan Levkivskyi wrote: Hello, There appeared a question in the discussion on http://bugs.python.org/issue24129 about documenting the behavior that unbound local variables in a class definition do not follow the normal rules. Guido said 13 years ago that this behavior s

[Python-Dev] Unbound locals in class scopes

2015-06-20 Thread Ivan Levkivskyi
Hello, There appeared a question in the discussion on http://bugs.python.org/issue24129 about documenting the behavior that unbound local variables in a class definition do not follow the normal rules. Guido said 13 years ago that this behavior should not be changed: https://mail.python.org/piper