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

Mailing List Archive: Python: Dev

2.7 Release? 2.7 == last of the 2.x line?

 

 

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


eric at trueblade

Nov 5, 2009, 12:22 PM

Post #126 of 131 (105 views)
Permalink
Re: 2.7 Release? 2.7 == last of the 2.x line? [In reply to]

Martin v. Löwis wrote:
>> Mike Krell wrote:
>>> Well, 3to2 would then be an option for you: use Python 3 as the source
>>> language.
>> Making life easier for 3to2 is an *excellent* rationale for backports.
>>
>
> I'm skeptical. If new features get added to 2.7: why would that simplify
> 3to2? It couldn't *use* these features, since it surely would have to
> support 2.6 and earlier as well.
>
> Not sure what 3to2 would do about difficult-to-convert 3.x feature (as,
> perhaps, the nonlocal keyword). If it currently gives up, it then may
> offer you to restrict your target versions to 2.7+. Not sure whether
> users would use that option, though - perhaps they rather stop using
> nonlocal in 3.x if 3to2 cannot support it for all 2.x versions they are
> interested in.

But surely someday 2.7 will be the oldest targetted 2.x version of
Python for 3to2 and other tools (regardless of whether there's a 2.8).
When that day comes, 3to2 can be made simpler, or can increase the
amount of Python 3.x it can convert (or both) if we add 3.x features to 2.7.

Of course, planning for a time so far in the future is difficult, and
possibly pointless.
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
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 5, 2009, 12:22 PM

Post #127 of 131 (105 views)
Permalink
Re: 2.7 Release? 2.7 == last of the 2.x line? [In reply to]

Martin v. Löwis wrote:
>> Mike Krell wrote:
>>
>>> Well, 3to2 would then be an option for you: use Python 3 as the source
>>> language.
>>>
>> Making life easier for 3to2 is an *excellent* rationale for backports.
>>
>>
>
> I'm skeptical. If new features get added to 2.7: why would that simplify
> 3to2? It couldn't *use* these features, since it surely would have to
> support 2.6 and earlier as well.
>
> Not sure what 3to2 would do about difficult-to-convert 3.x feature (as,
> perhaps, the nonlocal keyword). If it currently gives up, it then may
> offer you to restrict your target versions to 2.7+. Not sure whether
> users would use that option, though - perhaps they rather stop using
> nonlocal in 3.x if 3to2 cannot support it for all 2.x versions they are
> interested in.
>

I would have thought you could translate nonlocal with the following:

Python 3:

def scope():
name = value
do_something_with(name)
def inner():
nonlocal name
name = new_value
do_something_else(name)

Python 2

def scope():
name = [value]
do_something_with(name[0])
def inner():
name[0] = new_value
do_something_else(name[0])

I would love to see nonlocal backported to 2.7 as it cleans up a simple
pattern that I use relatively often for testing.


Suppose you have an class and you want to test that method a calls
method b, in Python 2 you might write something like this:

def test_method_a_calls_method_b():
instance = SomeClass()
was_called = []
def method_b():
was_called.append(True)

instance.method_b = method_b
instance.method_a()

assert was_called == [True]

in Python 3 you can replace this with the slightly nicer:


def test_method_a_calls_method_b():
instance = SomeClass()
was_called = False
def method_b():
nonlocal was_called
was_called = True

instance.method_b = method_b
instance.method_a()

assert was_called

As to the argument that releasing 2.7 is pointless as few people would
use it for several years, the success of Python 2.6 shows that although
*many* people don't / can't use new versions of Python for several years
many other people are able to and do use new versions of Python.

All the best,

Michael Foord

> Perhaps 3to2 has a work-around that still provides a good backport in
> most cases. Then, the backport would not make the tool any simpler: if
> 3to2 would start using the backport, it would actually get more
> complicated (not easier), as it now needs to support two cases.
>
> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev[at]python.org
> 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.org
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 5, 2009, 12:31 PM

Post #128 of 131 (105 views)
Permalink
Re: 2.7 Release? 2.7 == last of the 2.x line? [In reply to]

2009/11/4 ssteinerX[at]gmail.com <ssteinerx[at]gmail.com>:
> Maybe the 3.x line should just be put out of our misery, merged back to 2.7,
> 2.8, 2.9, and proceed as Glyph suggested in passing with increasing levels
> of deprecation until it just turns into 3.x on its own by running out of
> numbers.

Yeah, maybe. If people haven't moved over to Python 3 in 2015 I think
we should start considering it. Let's discuss this again then.

--
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
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 5, 2009, 12:39 PM

Post #129 of 131 (105 views)
Permalink
Re: 2.7 Release? 2.7 == last of the 2.x line? [In reply to]

On Thu, Nov 5, 2009 at 09:34, Yuvgoog Greenle <ubershmekel[at]gmail.com> wrote:
> On Thu, Nov 5, 2009 at 2:31 PM, Nick Coghlan <ncoghlan[at]gmail.com> wrote:
>>
>> While it may be hard to tell without knowing who is and isn't a core
>> developer
>
> Maybe there should be badges or something, hmmm, sounds like making an
> svn-commits-hall-of-fame for python could be a nice project.
>

You might be interested in http://www.ohloh.net/p/python/contributors .

-Brett


> --yuv
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev[at]python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>
>
_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
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

Nov 5, 2009, 1:46 PM

Post #130 of 131 (105 views)
Permalink
Re: 2.7 Release? 2.7 == last of the 2.x line? [In reply to]

Michael Foord <fuzzyman <at> voidspace.org.uk> writes:
>
> I would love to see nonlocal backported to 2.7 as it cleans up a simple
> pattern that I use relatively often for testing.

Well you know I'm sure that if someone proposes a proper patch it will
eventually get accepted ;)

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev[at]python.org
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

Nov 5, 2009, 8:12 PM

Post #131 of 131 (102 views)
Permalink
Re: 2.7 Release? 2.7 == last of the 2.x line? [In reply to]

On Thu, Nov 5, 2009 at 1:08 PM, "Martin v. Löwis" <martin[at]v.loewis.de>wrote:

> > Mike Krell wrote:
> >> Well, 3to2 would then be an option for you: use Python 3 as the
> source
> >> language.
> >
> > Making life easier for 3to2 is an *excellent* rationale for backports.
>

Clarifying a bit of potentially misleading editing: I wrote neither of the
statements quoted above. M v L wrote the first and Nick C. wrote the
second.


> I'm skeptical. If new features get added to 2.7: why would that simplify
> 3to2? It couldn't *use* these features, since it surely would have to
> support 2.6 and earlier as well.
>
> Not sure what 3to2 would do about difficult-to-convert 3.x feature (as,
> perhaps, the nonlocal keyword). If it currently gives up, it then may
> offer you to restrict your target versions to 2.7+. Not sure whether
> users would use that option, though - perhaps they rather stop using
> nonlocal in 3.x if 3to2 cannot support it for all 2.x versions they are
> interested in.
>

> Perhaps 3to2 has a work-around that still provides a good backport in
> most cases. Then, the backport would not make the tool any simpler: if
> 3to2 would start using the backport, it would actually get more
> complicated (not easier), as it now needs to support two cases.
>

I basically agree with you here, except perhaps for the likely definition of
"versions they are interested in". You have suggested on several occasions
that a 2.7 (or 2.8) containing new syntax such as nonlocal would be of
limited value because the vast majority of developers interested in
supporting 2.x would have to support 2.6 as well. I respectfully suggest
that may not necessarily be the case. I suspect that there are lots of
small fish out there like me who have the luxury of being able to hop onto
whatever version of the language suits them the best. Not to mention all of
the new users who will be drawn to Python over the next several years while
the 3.x standard library and third party library situation becomes more
stable and comprehensive. Why not make the 2.x feature set the best it can
be given the likelihood that 2.x will be the most compelling alternative to
many users until the 3.x libraries mature?

Of course, it's easy for me to ask other people to the hard work. It might
be fun to take a crack at implementing nonlocal myself, but I know next to
nothing about the implementation of CPython. By the time I pestered y'all
with enough questions to get up to speed, you'd probably wish you'd just
implemented it yourself -- less work :-)

Mike

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


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.