Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

nonlocal keyword in 2.x?

 

 

First page Previous page 1 2 Next page Last page  View All Python dev RSS feed   Index | Next | Previous | View Threaded


mbk.lists at gmail

Oct 21, 2009, 6:56 PM

Post #1 of 37 (1636 views)
Permalink
nonlocal keyword in 2.x?

Is there any possibility of backporting support for the nonlocal keyword
into a 2.x release? I see it's not in 2.6, but I don't know if that was an
intentional design choice or due to a lack of demand / round tuits. I'm
also not sure if this would fall under the scope of the proposed moratorium
on new language features (although my first impression was that it could be
allowed since it already exists in python 3.

One of my motivations for asking is a recent blog post by Fernando Perez of
IPython fame that describes an interesting decorator-based idiom inspired by
Apple's Grand Central Dispatch which would allow many interesting
possibilities for expressing parallelization and other manipulations of
execution context for blocks of python code. Unfortunately, using the
technique to its fullest extent requires the nonlocal keyword.

The blog post is here:
https://cirl.berkeley.edu/fperez/py4science/decorators.html

Mike


nnorwitz at gmail

Oct 21, 2009, 9:46 PM

Post #2 of 37 (1609 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On Wed, Oct 21, 2009 at 6:56 PM, Mike Krell <mbk.lists [at] gmail> wrote:
> Is there any possibility of backporting support for the nonlocal keyword
> into a  2.x release?  I see it's not in 2.6, but I don't know if that was an
> intentional design choice or due to a lack of demand / round tuits.  I'm
> also not sure if this would fall under the scope of the proposed moratorium
> on new language features (although my first impression was that it could be
> allowed since it already exists in python 3.

IIRC, Jeremy Hylton tried to backport it during a Pycon sprint a few
years back. I think it was difficult and he dropped it. I don't know
if there were any showstoppers or if Jeremy saved his work...or if my
memory is even correct. :-)

n
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


fabiofz at gmail

Oct 22, 2009, 8:32 AM

Post #3 of 37 (1614 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On Wed, Oct 21, 2009 at 10:56 PM, Mike Krell <mbk.lists [at] gmail> wrote:
> Is there any possibility of backporting support for the nonlocal keyword
> into a  2.x release?  I see it's not in 2.6, but I don't know if that was an
> intentional design choice or due to a lack of demand / round tuits.  I'm
> also not sure if this would fall under the scope of the proposed moratorium
> on new language features (although my first impression was that it could be
> allowed since it already exists in python 3.
>
> One of my motivations for asking is a recent blog post by Fernando Perez of
> IPython fame that describes an interesting decorator-based idiom inspired by
> Apple's Grand Central Dispatch which would allow many interesting
> possibilities for expressing parallelization and other manipulations of
> execution context for blocks of python code.  Unfortunately, using the
> technique to its fullest extent requires the nonlocal keyword.
>
> The blog post is here:
> https://cirl.berkeley.edu/fperez/py4science/decorators.html
>

Just as a note, the nonlocal there is not a requirement...

You can just create a mutable object there and change that object (so,
you don't need to actually rebind the object in the outer scope).

E.g.: instead of creating a float in the context, create a list with a
single float and change the float in the list (maybe the nonlocal
would be nicer, but it's certainly still usable)

Cheers,

Fabio
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


martin at v

Oct 22, 2009, 1:24 PM

Post #4 of 37 (1604 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

Mike Krell wrote:
> Is there any possibility of backporting support for the nonlocal keyword
> into a 2.x release?

If so, only into 2.7. Can you please explain why it would be desirable
to do that? 2.7 will likely be the last 2.x release, so only a fairly
small portion of the applications would be actually able to use this (or
any other new feature added to 2.7): most code supporting 2.x will also
have to support 2.6, so the keyword won't be available to such code,
anyway.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


exarkun at twistedmatrix

Oct 22, 2009, 1:46 PM

Post #5 of 37 (1609 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On 08:24 pm, martin [at] v wrote:
>Mike Krell wrote:
>>Is there any possibility of backporting support for the nonlocal
>>keyword
>>into a 2.x release?
>
>If so, only into 2.7. Can you please explain why it would be desirable
>to do that? 2.7 will likely be the last 2.x release, so only a fairly
>small portion of the applications would be actually able to use this
>(or
>any other new feature added to 2.7): most code supporting 2.x will also
>have to support 2.6, so the keyword won't be available to such code,
>anyway.

For the same reason that it is desirable to backport all of the other
changes from 3.x - because it makes the 2.x to 3.x transition easier.

If Python 2.7 supports the nonlocal keyword, then 2.7 becomes that much
better of a stepping stone towards 3.x.

You've suggested that most 2.x code will have to support 2.6 and so
won't be able to use the nonlocal keyword even if it is added to 2.7.
This precise argument could be applied to all of the features in 2.6
which aim to bring it closer to 3.x. Any program which must retain
Python 2.5 compatibility will not be able to use them. Yet 2.6 is a
more useful stepping stone towards 3.x than 2.5 is.

So yes, it would be quite desirable to see nonlocal and as many other
3.x features as possible backported for 2.7. And depending on how close
2.7 manages to get, it may make sense to backport anything that doesn't
make it into 2.7 for a 2.8 release.

The 3.x transition is *hard*. Anything that makes it easier is good.

Jean-Paul
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


martin at v

Oct 22, 2009, 1:57 PM

Post #6 of 37 (1599 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

exarkun [at] twistedmatrix wrote:
> On 08:24 pm, martin [at] v wrote:
>> Mike Krell wrote:
>>> Is there any possibility of backporting support for the nonlocal keyword
>>> into a 2.x release?
>>
>> If so, only into 2.7. Can you please explain why it would be desirable
>> to do that? 2.7 will likely be the last 2.x release, so only a fairly
>> small portion of the applications would be actually able to use this (or
>> any other new feature added to 2.7): most code supporting 2.x will also
>> have to support 2.6, so the keyword won't be available to such code,
>> anyway.
>
> For the same reason that it is desirable to backport all of the other
> changes from 3.x - because it makes the 2.x to 3.x transition easier.

Hmm. Really?

> If Python 2.7 supports the nonlocal keyword, then 2.7 becomes that much
> better of a stepping stone towards 3.x.

What use has such a stepping stone? Why, and (more importantly) when
would anybody currently supporting 2.x give up 2.6 and earlier, and
only support 2.7? And, if they chose to do so, why would they not move
the code base to 3.x right away?

> You've suggested that most 2.x code will have to support 2.6 and so
> won't be able to use the nonlocal keyword even if it is added to 2.7.

Correct.

> This precise argument could be applied to all of the features in 2.6
> which aim to bring it closer to 3.x.

Not so. One of the features added to 2.6 was the 3k warning. This
warning can be used without any modification to the code. So code
can run on 2.6 and use the feature, while running unmodified on 2.5
and earlier (not using it).

As for actual language and library changes (such as any new future
import): there was indeed little point adding them. However, given
that the possible migration paths weren't as clear back then as they
are now, it is understandable that people considered this a viable
path.

In addition, for 2.6, it's a bit more realistic to assume that people
might drop 2.5 support and still support 2.x for some more time (in
particular as people wouldn't rule out a 2.8 release back then, either).

> Any program which must retain
> Python 2.5 compatibility will not be able to use them. Yet 2.6 is a
> more useful stepping stone towards 3.x than 2.5 is.

I disagree fairly much (except that the 3k warnings probably *are*
useful - even though I haven't ever used them myself).

> So yes, it would be quite desirable to see nonlocal and as many other
> 3.x features as possible backported for 2.7. And depending on how close
> 2.7 manages to get, it may make sense to backport anything that doesn't
> make it into 2.7 for a 2.8 release.

There might not be a 2.8 release at all, though.

> The 3.x transition is *hard*. Anything that makes it easier is good.

I agree. I question whether backporting features actually makes the
transition easier.

In addition, in the *specific* case: the nonlocal keyword isn't
necessary for a transition *at all*. Code that currently works without
it won't need it when ported to 3.x. You may not be able to use it while
maintaining 2.x and 3.x simultaneously, but you can certainly do the
transition just fine without it.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


fuzzyman at voidspace

Oct 22, 2009, 2:08 PM

Post #7 of 37 (1604 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

Martin v. Löwis wrote:
> exarkun [at] twistedmatrix wrote:
>
>> On 08:24 pm, martin [at] v wrote:
>>
>>> Mike Krell wrote:
>>>
>>>> Is there any possibility of backporting support for the nonlocal keyword
>>>> into a 2.x release?
>>>>
>>> If so, only into 2.7. Can you please explain why it would be desirable
>>> to do that? 2.7 will likely be the last 2.x release, so only a fairly
>>> small portion of the applications would be actually able to use this (or
>>> any other new feature added to 2.7): most code supporting 2.x will also
>>> have to support 2.6, so the keyword won't be available to such code,
>>> anyway.
>>>
>> For the same reason that it is desirable to backport all of the other
>> changes from 3.x - because it makes the 2.x to 3.x transition easier.
>>
>
> Hmm. Really?
>
>
>> If Python 2.7 supports the nonlocal keyword, then 2.7 becomes that much
>> better of a stepping stone towards 3.x.
>>
>
> What use has such a stepping stone? Why, and (more importantly) when
> would anybody currently supporting 2.x give up 2.6 and earlier, and
> only support 2.7? And, if they chose to do so, why would they not move
> the code base to 3.x right away?
>


From the Django roadmap for supporting 3.0, using 2.6 as a stepping
stone (and if 2.7 was a *better* stepping stone then it would make it
easier):

http://groups.google.com/group/django-developers/msg/0888b1c8f2518059?


* First half of 2009: Django 1.1 is released, with a notification that
it will be the final release supporting Python 2.3.

* Second half of 2009: Django 1.2 is released, drops Python 2.3
support and is the final release supporting Python 2.4.

* First half of 2010: Django 1.3 is released, drops Python 2.4 support
and is the final release supporting Python 2.5.

* Second half of 2010: Django 1.4 is released and drops Python 2.5
support.

This gets us to a situation where, about a year after the release of
Python 3.0, Django will be ready to make the transition -- the only
2.x Python we'll be supporting is Python 2.6, and 2to3 plus manual
effort and available supporting libraries should make it possible to
also run Django on Python 3.0 either at that point or not long after.

From there, 2.6 support can be dropped whenever convenient, and Django
can move to running only on Python 3.x at whatever time is judged
appropriate.


All the best,

Michael Foord

>
>> You've suggested that most 2.x code will have to support 2.6 and so
>> won't be able to use the nonlocal keyword even if it is added to 2.7.
>>
>
> Correct.
>
>
>> This precise argument could be applied to all of the features in 2.6
>> which aim to bring it closer to 3.x.
>>
>
> Not so. One of the features added to 2.6 was the 3k warning. This
> warning can be used without any modification to the code. So code
> can run on 2.6 and use the feature, while running unmodified on 2.5
> and earlier (not using it).
>
> As for actual language and library changes (such as any new future
> import): there was indeed little point adding them. However, given
> that the possible migration paths weren't as clear back then as they
> are now, it is understandable that people considered this a viable
> path.
>
> In addition, for 2.6, it's a bit more realistic to assume that people
> might drop 2.5 support and still support 2.x for some more time (in
> particular as people wouldn't rule out a 2.8 release back then, either).
>
>
>> Any program which must retain
>> Python 2.5 compatibility will not be able to use them. Yet 2.6 is a
>> more useful stepping stone towards 3.x than 2.5 is.
>>
>
> I disagree fairly much (except that the 3k warnings probably *are*
> useful - even though I haven't ever used them myself).
>
>
>> So yes, it would be quite desirable to see nonlocal and as many other
>> 3.x features as possible backported for 2.7. And depending on how close
>> 2.7 manages to get, it may make sense to backport anything that doesn't
>> make it into 2.7 for a 2.8 release.
>>
>
> There might not be a 2.8 release at all, though.
>
>
>> The 3.x transition is *hard*. Anything that makes it easier is good.
>>
>
> I agree. I question whether backporting features actually makes the
> transition easier.
>
> In addition, in the *specific* case: the nonlocal keyword isn't
> necessary for a transition *at all*. Code that currently works without
> it won't need it when ported to 3.x. You may not be able to use it while
> maintaining 2.x and 3.x simultaneously, but you can certainly do the
> transition just fine without it.
>
> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev [at] python
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
>


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


martin at v

Oct 22, 2009, 2:51 PM

Post #8 of 37 (1594 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

> From the Django roadmap for supporting 3.0, using 2.6 as a stepping
> stone (and if 2.7 was a *better* stepping stone then it would make it
> easier):
>
> http://groups.google.com/group/django-developers/msg/0888b1c8f2518059?

Is that still a current plan? It's from November 2008.

> This gets us to a situation where, about a year after the release of
> Python 3.0, Django will be ready to make the transition -- the only
> 2.x Python we'll be supporting is Python 2.6, and 2to3 plus manual
> effort and available supporting libraries should make it possible to
> also run Django on Python 3.0 either at that point or not long after.
>
> From there, 2.6 support can be dropped whenever convenient, and Django
> can move to running only on Python 3.x at whatever time is judged
> appropriate.

I would claim that this specific plan was ignoring opportunities
for migrating to Python 3.0. My Django port demonstrates that you
can very well support 2.3 and 3.0 simultaneously:

http://wiki.python.org/moin/PortingDjangoTo3k

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


fperez.net at gmail

Oct 22, 2009, 11:07 PM

Post #9 of 37 (1604 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On Thu, 22 Oct 2009 12:32:37 -0300, Fabio Zadrozny wrote:


> Just as a note, the nonlocal there is not a requirement...
>
> You can just create a mutable object there and change that object (so,
> you don't need to actually rebind the object in the outer scope).
>
> E.g.: instead of creating a float in the context, create a list with a
> single float and change the float in the list (maybe the nonlocal would
> be nicer, but it's certainly still usable)

Yup, that's what I meant by 'some slightly ugly solutions' in this note:

http://mail.scipy.org/pipermail/ipython-dev/2009-September/005529.html

in the thread that spawned those notes. nonlocal allows for this pattern
to work without the ugliness of writing code like:

s = [s]

@somedeco
def foo():
s[0] += 1

s = s[0]

just to be able to 'change s' inside the foo() scope.


I felt this was both obvious and ugly enough not to warrant too much
explicit mention, but I probably should have left it there for the sake of
completeness. Thanks for the feedback.

Cheers,

f

ps - the above shouldn't be taken as either pro or con on the idea of
nonlocal in 2.x, just a clarification on why I didn't add the mutable
container trick to the original notes.

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


mbk.lists at gmail

Oct 23, 2009, 12:30 AM

Post #10 of 37 (1586 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On Thu, Oct 22, 2009 at 1:24 PM, "Martin v. Löwis" <martin [at] v>wrote:

> Can you please explain why it would be desirable
> to [backport nonlocal]? 2.7 will likely be the last 2.x release, so only a
> fairly
> small portion of the applications would be actually able to use this (or
> any other new feature added to 2.7): most code supporting 2.x will also
> have to support 2.6, so the keyword won't be available to such code,
> anyway.
>

Others have explained the rationale for the backport, so I won't bother
repeating those arguments.

I understand your point about code supporting 2.6, but as you say, that
applies to any new features being added in 2.7. I'm therefore confused as
to what the rationale for a 2.7 release is. It's a bump in minor release
number, so it's purpose is to add new features, correct?

Could someone please explain what new features are currently envisioned for
2.7? Why would those make the cut but a not backport of nonlocal?

Mike


martin at v

Oct 23, 2009, 1:15 AM

Post #11 of 37 (1597 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

> Others have explained the rationale for the backport, so I won't bother
> repeating those arguments.
>
> I understand your point about code supporting 2.6, but as you say, that
> applies to any new features being added in 2.7. I'm therefore confused
> as to what the rationale for a 2.7 release is. It's a bump in minor
> release number, so it's purpose is to add new features, correct?

That, but not only - it's purpose is also to allow for certain
incompatible changes, and to arrive at a version that will be maintained
until 2015 (wrt. security fixes).

> Could someone please explain what new features are currently envisioned
> for 2.7?

Read through Misc/NEWS for details of what has been added already.

> Why would those make the cut but a not backport of nonlocal?

Just to name a few changes:
- Issue #1655: Make imaplib IPv6-capable. Patch by Derek Morr.
- Issue #4915: Port sysmodule to Windows CE.
- Issue #6101: A new opcode, SETUP_WITH, has been added to speed up the
with statement and correctly lookup the __enter__ and __exit__
special methods.
- Issue #1616979: Added the cp720 (Arabic DOS) encoding.

In all of these cases, in order to use the new feature, no change to
Python code will be necessary: the feature just becomes available
transparently.

This is the kind of new features I like to see in 2.7.
The other kind (i.e. features that do require application changes
in order to use them) I find questionable.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


kmtracey at gmail

Oct 23, 2009, 11:05 AM

Post #12 of 37 (1571 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On Thu, Oct 22, 2009 at 5:51 PM, "Martin v. Löwis" <martin [at] v>wrote:

> > From the Django roadmap for supporting 3.0, using 2.6 as a stepping
> > stone (and if 2.7 was a *better* stepping stone then it would make it
> > easier):
> >
> > http://groups.google.com/group/django-developers/msg/0888b1c8f2518059
> ?
>
> Is that still a current plan? It's from November 2008.
>
>
Django 1.1 came out in 2H09, not 1H09, and Django 1.2 is now looking to come
out in 1H10, not 2H09, so the dates in that note have slipped out by 3-6
months. (The labeling of some features as must-have for a release has been
dropped for 1.2, so as to hopefully prevent the kind of slip seen with
1.1.) Django 1.2 is still scheduled to drop Python 2.3 support. I think
it's too early to say whether Python 2.4 support will be dropped with 1.3,
nor do I have any good idea when supporting 3.x will become a priority.

Karen


regebro at gmail

Oct 27, 2009, 11:30 PM

Post #13 of 37 (1505 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

2009/10/22 "Martin v. Löwis" <martin [at] v>:
> What use has such a stepping stone? Why, and (more importantly) when
> would anybody currently supporting 2.x give up 2.6 and earlier, and
> only support 2.7? And, if they chose to do so, why would they not move
> the code base to 3.x right away?

Python 2 support is not only about supporting old versions of Python,
but also supporting users of Python2-only modules.

If you have a module that runs only on Python 2.7, the people who for
some reason can not move to Python 3 yet, can still use it, by running
Python 2.7. For that your module doesn't have to run on 2.6 or 2.5.


So 2.7 support will for the most part be a case not of supporting
Python versions, but Python *users*.
Which is a good thing.

--
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


solipsis at pitrou

Oct 28, 2009, 2:12 AM

Post #14 of 37 (1506 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

Lennart Regebro <regebro <at> gmail.com> writes:
>
> So 2.7 support will for the most part be a case not of supporting
> Python versions, but Python *users*.

That's still not a good reason to backport nonlocal. The same reasoning could be
used to backport new features to the 2.6 branch after all.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


skip at pobox

Oct 28, 2009, 6:35 AM

Post #15 of 37 (1493 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

>> So 2.7 support will for the most part be a case not of supporting
>> Python versions, but Python *users*.

Antoine> That's still not a good reason to backport nonlocal. The same
Antoine> reasoning could be used to backport new features to the 2.6
Antoine> branch after all.

No, because 2.6 is in feature freeze (bug fixes only). 2.7 is the current
version of 2.x where new features are allowed to be added.

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


solipsis at pitrou

Oct 28, 2009, 7:49 AM

Post #16 of 37 (1492 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

<skip <at> pobox.com> writes:
>
> >> So 2.7 support will for the most part be a case not of supporting
> >> Python versions, but Python *users*.
>
> Antoine> That's still not a good reason to backport nonlocal. The same
> Antoine> reasoning could be used to backport new features to the 2.6
> Antoine> branch after all.
>
> No, because 2.6 is in feature freeze (bug fixes only). 2.7 is the current
> version of 2.x where new features are allowed to be added.

That was precisely my point. There are development practices which mitigate the
idea that backporting is always helpful to the user.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


regebro at gmail

Oct 29, 2009, 1:15 AM

Post #17 of 37 (1486 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

2009/10/28 Antoine Pitrou <solipsis [at] pitrou>:
> <skip <at> pobox.com> writes:
>>
>>     >> So 2.7 support will for the most part be a case not of supporting
>>     >> Python versions, but Python *users*.
>>
>>     Antoine> That's still not a good reason to backport nonlocal. The same
>>     Antoine> reasoning could be used to backport new features to the 2.6
>>     Antoine> branch after all.
>>
>> No, because 2.6 is in feature freeze (bug fixes only).  2.7 is the current
>> version of 2.x where new features are allowed to be added.
>
> That was precisely my point.

Then I don't understand what you are saying. Obviously we shouldn't
backport to the 2.6 branch, it's in bugfix mode. This is about 2.7. I
don't see what 2.6 has to do with it.

> There are development practices which mitigate the
> idea that backporting is always helpful to the user.

And those are?

--
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


ncoghlan at gmail

Oct 29, 2009, 2:23 AM

Post #18 of 37 (1485 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

Lennart Regebro wrote:
> 2009/10/28 Antoine Pitrou <solipsis [at] pitrou>:
>> <skip <at> pobox.com> writes:
>>> >> So 2.7 support will for the most part be a case not of supporting
>>> >> Python versions, but Python *users*.
>>>
>>> Antoine> That's still not a good reason to backport nonlocal. The same
>>> Antoine> reasoning could be used to backport new features to the 2.6
>>> Antoine> branch after all.
>>>
>>> No, because 2.6 is in feature freeze (bug fixes only). 2.7 is the current
>>> version of 2.x where new features are allowed to be added.
>> That was precisely my point.
>
> Then I don't understand what you are saying. Obviously we shouldn't
> backport to the 2.6 branch, it's in bugfix mode. This is about 2.7. I
> don't see what 2.6 has to do with it.
>
>> There are development practices which mitigate the
>> idea that backporting is always helpful to the user.
>
> And those are?

You said it above yourself: "bugfix mode"

That's all Antoine's point was - backporting of new features to previous
branches is not automatically a good idea.

In the case of 3.2 -> 2.7 backports, there are issues with the initial
development time investment to do the backport, future double-keying of
additional maintenance issues, consideration of possible poor
interaction with legacy features in the 2.x series. It's a bunch of
additional work that isn't going to happen without someone volunteering
to do it.

Cheers,
Nick.

--
Nick Coghlan | ncoghlan [at] gmail | Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


regebro at gmail

Nov 1, 2009, 1:26 PM

Post #19 of 37 (1420 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

2009/10/29 Nick Coghlan <ncoghlan [at] gmail>:
> Lennart Regebro wrote:
>> 2009/10/28 Antoine Pitrou <solipsis [at] pitrou>:
>>> <skip <at> pobox.com> writes:
>>>>     >> So 2.7 support will for the most part be a case not of supporting
>>>>     >> Python versions, but Python *users*.
>>>>
>>>>     Antoine> That's still not a good reason to backport nonlocal. The same
>>>>     Antoine> reasoning could be used to backport new features to the 2.6
>>>>     Antoine> branch after all.
>>>>
>>>> No, because 2.6 is in feature freeze (bug fixes only).  2.7 is the current
>>>> version of 2.x where new features are allowed to be added.
>>> That was precisely my point.
>>
>> Then I don't understand what you are saying. Obviously we shouldn't
>> backport to the 2.6 branch, it's in bugfix mode. This is about 2.7. I
>> don't see what 2.6 has to do with it.
>>
>>> There are development practices which mitigate the
>>> idea that backporting is always helpful to the user.
>>
>> And those are?
>
> You said it above yourself: "bugfix mode"

Again: Then I don't understand what you are saying. Obviously we
shouldn't backport to the 2.6 branch, it's in bugfix mode. This is
about 2.7. I don't see what 2.6 has to do with it.

> That's all Antoine's point was - backporting of new features to previous
> branches is not automatically a good idea.

Obviously we shouldn't backport to the 2.6 branch, it's in bugfix
mode. This is about 2.7. I don't see what 2.6 has to do with it.

> In the case of 3.2 -> 2.7 backports, there are issues with the initial
> development time investment to do the backport, future double-keying of
> additional maintenance issues, consideration of possible poor
> interaction with legacy features in the 2.x series. It's a bunch of
> additional work that isn't going to happen without someone volunteering
> to do it.

Yes?

I feel that you are saying things that are obvious, and that you then
expect me to draw a conclusion from this, that you probably find
obvious too, but I don't. So I still don't understand what you are
saying, or how this in any way contradicts what I said, or clarified
or expanded on the matter.


As I said: Python 2 support is not only about supporting old versions of Python,
but also supporting users of Python2-only modules. So 2.7 support will
for the most part be a case not of supporting Python versions, but
Python *users*. And contrary to what Antoine said, that *is* a good
reason to backport it.

--
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


python at rcn

Nov 1, 2009, 1:39 PM

Post #20 of 37 (1419 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

> As I said: Python 2 support is not only about supporting old versions of Python,
> but also supporting users of Python2-only modules. So 2.7 support will
> for the most part be a case not of supporting Python versions, but
> Python *users*. And contrary to what Antoine said, that *is* a good
> reason to backport it.

FWIW, I support backporting the nonlocal-keyword in 2.7.
All of the reasons for introducting nonlocal to 3.x also apply to 2.x.
Using the nonlocal keyword in clear and explicit, especially
when compared to the existing workarounds which are not pretty.


Raymond
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


brett at python

Nov 1, 2009, 3:57 PM

Post #21 of 37 (1416 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On Sun, Nov 1, 2009 at 13:39, Raymond Hettinger <python [at] rcn> wrote:
>> As I said: Python 2 support is not only about supporting old versions of
>> Python,
>> but also supporting users of Python2-only modules. So 2.7 support will
>> for the most part be a case not of supporting Python versions, but
>> Python *users*. And contrary to what Antoine said, that *is* a good
>> reason to backport it.
>
> FWIW, I support backporting the nonlocal-keyword in 2.7.
> All of the reasons for introducting nonlocal to 3.x also apply to 2.x.
> Using the nonlocal keyword in clear and explicit, especially
> when compared to the existing workarounds which are not pretty.

We are voting, I'm -0.

-Brett
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


fuzzyman at voidspace

Nov 2, 2009, 12:29 AM

Post #22 of 37 (1395 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

Brett Cannon wrote:
> On Sun, Nov 1, 2009 at 13:39, Raymond Hettinger <python [at] rcn> wrote:
>
>>> As I said: Python 2 support is not only about supporting old versions of
>>> Python,
>>> but also supporting users of Python2-only modules. So 2.7 support will
>>> for the most part be a case not of supporting Python versions, but
>>> Python *users*. And contrary to what Antoine said, that *is* a good
>>> reason to backport it.
>>>
>> FWIW, I support backporting the nonlocal-keyword in 2.7.
>> All of the reasons for introducting nonlocal to 3.x also apply to 2.x.
>> Using the nonlocal keyword in clear and explicit, especially
>> when compared to the existing workarounds which are not pretty.
>>
>
> We are voting, I'm -0.
>

nonlocal is really useful for tests so I'd love to have this in 2.7, but
obviously someone has to do the work so I'm only +0.

Michael

> -Brett
> _______________________________________________
> Python-Dev mailing list
> Python-Dev [at] python
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
>


--
http://www.ironpythoninaction.com/

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


guido at python

Nov 2, 2009, 10:01 AM

Post #23 of 37 (1384 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

I'm -0 on backporting nonlocal to 2.7. I could be +0 if we added "from
__future__ import nonlocal_keyword" (or some such phrasing) to enable
it.

--
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


python at rcn

Nov 2, 2009, 10:06 AM

Post #24 of 37 (1387 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

[Guido van Rossum]
> I'm -0 on backporting nonlocal to 2.7. I could be +0 if we added "from
> __future__ import nonlocal_keyword" (or some such phrasing) to enable
> it.

With the "from __future__" option, what keeps you from being
a full +1 on nonlocal? Is there something that makes it a better
solution for 3.x than 2.x? Just curious about the pros and cons
from your point of view.


Raymond
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


guido at python

Nov 2, 2009, 10:09 AM

Post #25 of 37 (1384 views)
Permalink
Re: nonlocal keyword in 2.x? [In reply to]

On Mon, Nov 2, 2009 at 10:06 AM, Raymond Hettinger <python [at] rcn> wrote:
>
> [Guido van Rossum]
>>
>> I'm -0 on backporting nonlocal to 2.7. I could be +0 if we added "from
>> __future__ import nonlocal_keyword" (or some such phrasing) to enable
>> it.
>
> With the "from __future__" option, what keeps you from being
> a full +1 on nonlocal?   Is there something that makes it a better
> solution for 3.x than 2.x?  Just curious about the pros and cons
> from your point of view.

I think the number of projects that can afford to drop support for 2.6
is pretty limited, so I think the utility of the feature is thereby
also limited.

--
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

First page Previous page 1 2 Next page Last page  View All Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.