the future of python 2

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

the future of python 2

#1 Post by nosystemdthanks »

when i decided which python to learn, i chose the one that seemed like less trouble. your opinion may vary, theres a lot of effort to make people get away from python 2.

the python foundation will abandon python 2 on january 1 of the coming year.

a lot of us have known about this for some time. i knew a developer from nokia, who still prefers python 2. i prefer it, because it is a simpler language that google hasnt made "more enterprise." which doesnt mean you cant do enterprise applications with it.

when this topic comes up, people post the link to the pythonclock. i post the link to pypy.org instead.

python is a language, but what is being abandoned (no longer updated) is the python foundations python 2 interpreter.

i dont think everyone is going to just switch. absolutely, most distros will.

others will retain python 2 for some time, its not impossible for a group to even take it and fork it and maintain its security. if someone does, then there is no reason not to use python 2 if it is a better tool for the job.

to this day, not every library is ported over. some still require version 2. these will become rarer in use, but people will continue to use python 2 for these reasons. i heard the other day that someone is still using debian 5. i was still using debian 7, four years ago.

youre better off using python 2 than debian 5 these days. people have their reasons.

i have used pypy-- its a very solid python 2 replacement. its library support (for python 2) is not up to par, my main interest is getting pygame to work with pypy. if i can do that, it will be a suitable replacement. it works with pyglet, so i would consider (but not prefer) moving from pygame to pyglet.

i also have a version of my programming language that works with python 3, but as with the version of python itself, i really dont like the way strings work. its not the extra syntax for the print command, its the way they changed one of the most fundamental data structures.

as for the amount of time ive spent twiddling python 2 code to update it, its substantial. the reading i did was also substantial. its a lot of work, to support a move that i never approved of or truly found significant benefit from.

people forget, that if a user doesnt feel the benefit of your software-- just like someone who doesnt like the new ghostbusters film-- that blaming them for not liking it wont change a thing.

you can only give something so many chances before you have a pretty good idea its not for you.

there are other python interpreters. indeed, there are several. at brown university, they teach you how to implement the python language, among other things.

while the python foundation has made it clear what direction they want to go in, expecting everyone to line up that hasnt already is like expecting everyone to run out and get high when they legalise marijuana.

most of the people who were going to have done so already. yes, this will push people farther along into a version of python they clearly dont want, or isnt for them at this time.

many years theyve tried, for me all they would need to do is add from __past__ import strings.

for those who instead want to use python with braces, ive already got a solution for that. its not even the first one or the best, and that should tell you something about options.

http://pypy.org/compat.html



if you dont like mandatory indentation and want to code python with braces, simply code like this:

Code: Select all

for p in range(10): { 
if p > 5: { print("\{") 
print( p ) } }


then pipe the code through the following python script:

Code: Select all

#!/usr/bin/env python2
# coding: utf-8 
#### license: creative commons cc0 1.0 (public domain) 
#### http://creativecommons.org/publicdomain/zero/1.0/ 
proginf = "python with braces, feb 2019 mn"
from sys import stdin, stdout
from os import name as osname
nl = chr(10)
if osname == "nt": 
    nl = chr(13) + chr(10)
indent = 0
igwhite = 0
buf = ""
esc = 0
doublenl = 0
for p in stdin: 
    stdout.write(chr(32) * 4 * indent)
    for each in p.lstrip():
        # prevent spaces between braces from messing with indents
        if igwhite:
            if each in (chr(32), chr(9)):
                each = ""
            else:
                igwhite = 0
        # you must escape all braces that are not syntactic
        if buf == chr(92):
            if esc:
                if not each in "{}":
                    stdout.write(chr(92))
                esc = 0
        else:
            if each == "{":
                indent += 1
                each = nl + (chr(32) * 4 * indent) 
                igwhite = 1
            elif each == "}":
                indent -= 1
                each = nl
                igwhite = 1
            # these escapes arent brace related, so emit 
            else:
                if esc:
                    stdout.write(chr(92))
                    esc = 0
        if each != chr(92):
            stdout.write(each)
            stdout.flush()
        else:
            esc = 1
        buf = each
    # dont let indents concatenate
    if not p.lstrip():
        stdout.write(nl)
if esc:
    stdout.write(chr(92))
    esc = 0

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#2 Post by s243a »

I tend to write code for python 2 and I try to make it so it will also work on python 3. This often means using libraries that are back-ported from python 3 to python 2.
Last edited by s243a on Tue 19 Mar 2019, 21:34, edited 1 time in total.

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#3 Post by nosystemdthanks »

s243a wrote:I tend to write code for python 2 and I try to make it so it will also work on python 2. This often means using libraries that are back-ported from python 3 to python 2.
awesome. just the fact that people are back-porting some libraries to python 2 says a lot.

i can understand if the python foundation wants to stop effectively maintaining two languages. i hope their fans can understand that other people are likely willing to-- and some are willing to go to significant efforts to keep python 2 alive.

i know it has some advantages or people wouldnt use it, but i find lot of things in python 3 are more tedious and more work to do, except for code that is "deprecated" and could be removed from python 3 in the future.

to me, thats just google. it could be more than google, but i was never interested in what google thinks i should be doing. im not saying they dont know what theyre doing, but i have at least enjoyed coding for longer than google has even existed. they can do it their way-- i dont think they should expect me to.

User avatar
6502coder
Posts: 677
Joined: Mon 23 Mar 2009, 18:07
Location: Western United States

#4 Post by 6502coder »

The cynic in me wants to believe that the reason Guido van Rossum abdicated last year is that he had finally had enough of the zealots.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

Re: the future of python 2

#5 Post by wiak »

nosystemdthanks wrote:the python foundation will abandon python 2 on january 1 of the coming year.
About flipping time too. Having to install two pythons is a bloating pain.

More reasonable to have gtk2+ stick around (and for very small gui capable systems, gtk1+), but even then, sticking around with the old and not going with the low, is a very conservative approach to life. Move on, I say, and fix python3 if there is something wrong with it (and same goes to whatever gtk+ you are using - by all means introduce some slim routines as alternatives inside (for RAM-saving purposes or whatever...) but so painful to have to install so may versions of otherwise the same thing!

wiak

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#6 Post by jamesbond »

They could have done what Perl Foundation did.

Which is to declare that Perl 5 and Perl 6 are separate languages (even though both as "Perl" as the name). And both languages will continue to be supported, continue to evolve, till the day that they cease to be useful.

But that's apparently too hard for Python Foundation.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#7 Post by nosystemdthanks »

jamesbond wrote:They could have done what Perl Foundation did.

Which is to declare that Perl 5 and Perl 6 are separate languages (even though both as "Perl" as the name). And both languages will continue to be supported, continue to evolve, till the day that they cease to be useful.

But that's apparently too hard for Python Foundation.
agreed, though this is most likely what is going to happen either way.

or put in other terms... that seems to be what pypy is. note that the python foundation gave $10,000 to pypy in 2011, to encourage them to maintain compatibility. im definitely annoyed with the python foundation either way, but credit where credit is due.
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#8 Post by nosystemdthanks »

quick note, i got pip working in pypy, and used it to install pygments.

good news for pygame fans, pypy 6 (current stable is 5) will support pygame.

these things are important to making pypy a suitable python 2 replacement-- i didnt know what the options were past the standard library.
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#9 Post by s243a »

nosystemdthanks wrote:quick note, i got pip working in pypy, and used it to install pygments.

good news for pygame fans, pypy 6 (current stable is 5) will support pygame.

these things are important to making pypy a suitable python 2 replacement-- i didnt know what the options were past the standard library.
As another plus I recall someone saying that pypy is faster than standard python.

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#10 Post by nosystemdthanks »

s243a wrote:As another plus I recall someone saying that pypy is faster than standard python.
thats sort of half the point of pypy, at least it was back when the python foundation was supporting it, but its not always faster.

its significantly faster for certain things. most of the things i write are more likely to gain from parallelisation in a command pipeline than from pypy-- often you have to run a lot of programs for a while to gain a speed advantage. but now its also a way to retain python 2 support.
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

Post Reply