Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 21 Feb 2020, 06:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
the future of python 2
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
nosystemdthanks


Joined: 03 May 2018
Posts: 722

PostPosted: Tue 19 Mar 2019, 17:03    Post subject:  the future of python 2  

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:
for p in range(10): {
if p > 5: { print("\{")
print( p ) } }




then pipe the code through the following python script:

Code:
#!/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
Back to top
View user's profile Send private message Visit poster's website 
s243a

Joined: 02 Sep 2014
Posts: 2463

PostPosted: Tue 19 Mar 2019, 17:09    Post subject:  

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, 17:34; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
nosystemdthanks


Joined: 03 May 2018
Posts: 722

PostPosted: Tue 19 Mar 2019, 17:17    Post subject:  

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.
Back to top
View user's profile Send private message Visit poster's website 
6502coder


Joined: 23 Mar 2009
Posts: 663
Location: Western United States

PostPosted: Tue 19 Mar 2019, 17:42    Post subject:  

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.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1873
Location: not Bulgaria

PostPosted: Tue 19 Mar 2019, 19:59    Post subject: Re: the future of python 2  

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

_________________
New Puppy/Dog forum: https://puppylinux.rockedge.org
Tiny Linux Blog: https://www.tinylinux.info/
Check Firmware: http://murga-linux.com/puppy/viewtopic.php?p=1022797
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 3455
Location: The Blue Marble

PostPosted: Tue 19 Mar 2019, 21:17    Post subject:  

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: Latest version | Contributed packages | ISO builder
Back to top
View user's profile Send private message 
nosystemdthanks


Joined: 03 May 2018
Posts: 722

PostPosted: Wed 20 Mar 2019, 05:06    Post subject:  

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.

_________________
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.
Back to top
View user's profile Send private message Visit poster's website 
nosystemdthanks


Joined: 03 May 2018
Posts: 722

PostPosted: Fri 22 Mar 2019, 22:37    Post subject:  

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.

_________________
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.
Back to top
View user's profile Send private message Visit poster's website 
s243a

Joined: 02 Sep 2014
Posts: 2463

PostPosted: Fri 22 Mar 2019, 22:55    Post subject:  

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.
Back to top
View user's profile Send private message Visit poster's website 
nosystemdthanks


Joined: 03 May 2018
Posts: 722

PostPosted: Fri 22 Mar 2019, 23:49    Post subject:  

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.

_________________
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.
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0570s ][ Queries: 11 (0.0108s) ][ GZIP on ]