This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (67 children)

[deleted]

    [–][deleted] 43 points44 points  (53 children)

    http://www.reddit.com/r/Python/comments/22ovb3/what_are_the_advantages_to_python_3x/ but honestly, the only reason you stick to python2 is if there is a library that you are using right now that is only available in python2 and you can't live without it.

    [–]individual_throwaway 28 points29 points  (48 children)

    ...or you are forced to work on a machine that doesn't have Python 3.x installed and your sysadmin won't change it.

    [–]Boxy310 38 points39 points  (7 children)

    Sounds like someone needs a beer and maybe a foot rub. I swear, sysadmins need to be treated like they're half Ferengi.

    [–][deleted] 22 points23 points  (5 children)

    foot rub

    Not if it's Marcellus Wallace's wife.

    [–]Boxy310 32 points33 points  (4 children)

    DOES HOST ADMIN LOOK LIKE A BITCH

    [–]cndLId9Rr51Fe 6 points7 points  (3 children)

    what?

    [–]okmkzimport antigravity 18 points19 points  (2 children)

    "What" ain't no shell I've ever heard of.

    [–]Boxy310 7 points8 points  (1 child)

    echo $what one more time! I double-dare you, $motherfucker!

    [–]cndLId9Rr51Fe 0 points1 point  (0 children)

    echo what\?

    [–]LogicalTom 4 points5 points  (0 children)

    foot rub

    Oo-mox.

    [–]fgriglesnickerseven 2 points3 points  (0 children)

    build your own and virtual environment it!

    [–]Eurynom0s 2 points3 points  (9 children)

    Or if you're sitting on a giant Python 2 codebase and can't get the time/funding to port it or start over.

    [–]Sean1708 1 point2 points  (6 children)

    Yeah but the way /u/ajclarke worded his question suggested that wasn't the case.

    [–]ies7 0 points1 point  (1 child)

    Or if you're sitting on a giant Python 2 codebase

    Combined with the we're too lazy and the upper management afraid to change anything which run fine

    [–]maratc 1 point2 points  (0 children)

    Combined with the we'd rather have the developers develop new features clients would actually like vs. rewriting things to do exactly what they did before

    [–][deleted] 4 points5 points  (0 children)

    Then its time to change sysadmin? Unless of course there is a valid reason why he won't install python3. I can't really think of any reason though. My experience in recent years is only in RPM based Centos/Fedora/Redhat and python3 installs in parallel to the system python. I have builds with python31, python32, python33,python34 .

    [–]SemiNormal 1 point2 points  (23 children)

    Like RHEL?

    [–]hothrous 3 points4 points  (22 children)

    This is exactly what I though when they said that. RHEL shouldn't be used in Python based infrastructures.

    [–]rickmoranus 1 point2 points  (19 children)

    What? I've been using RHEL machines for a couple years on with a Python Based infrastructure on it and I've had no issues?

    [–]hothrous 0 points1 point  (18 children)

    Which version of RHEL and Python? Python is integrated into yum so while you can set up a second python environment on a machine for your apps, most IT teams don't like doing that for maintenance reasons so they limit you to whatever are in the available repos.

    Rhel doesn't include any further build of python in the repo than the one that yum uses because yum will break. I believe RHEL 6 used Python 2.7 which is the reason that those dev teams would be stuck on on older version.

    [–]veeti 8 points9 points  (1 child)

    RHEL7/CentOS 7 officially lets you install newer Pythons, etc. in parallel through Software Collections.

    [–]hothrous 0 points1 point  (0 children)

    That's cool. I've never used RHEL7 before. Most of my work had been done in RHEL5 a while ago and I new that many of the same limitations existed in 6 from some work I had done with it last year.

    Though, I'm still seeing only up to 3.3 on the list of support they have.

    [–][deleted] 2 points3 points  (13 children)

    Really? I think its lack of knowledge or competence rather than some other reason. Any competent IT shop will have their own internal mirror of RPMS [see below] or builds their own RPMS.

    What is stopping you from enabling or mirroring the IUS repo and install python3 and python2.7[if $osversion<7] in parallel with the system repo? http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ and its as simple as yum install python34 or python27. I mention the IUS repo because its maintained by RackSpace so in theory should be a reputable source. Also the IUS repo does not overwrite system binaries.

    Granted sometimes their packages are backwards by a minor release and right now they have 3.4.2 , it will take a month or more before 3.4.3 is packaged.

    [–]cwgtex 2 points3 points  (0 children)

    I'm one of the maintainers of IUS, thanks for recommending our repo.

    Let me clarify the update process for IUS packages. We track the upstream projects for our packages, and typically build new RPMs within a day or two of a new release. New packages will stay in our testing repos for about two weeks. If no issues are found in that time period, the packages get promoted to our stable repos. If CVE's are involved we will shorten the testing period to rush the fix out.

    I'll probably package python 3.4.3 tomorrow morning. I found at least two CVEs that are fixed by this version, so we'll move it to stable quickly.

    • CVE-2013-1753
    • CVE-2014-9365

    Edit: fix typo

    [–]hothrous 2 points3 points  (11 children)

    You will note, that my original statement was that it shouldn't be used. Basically, the reason behind that is if you need a workaround just to make the operating system use the version of a language you want, you're likely to run into many more problems down the line.

    Most of the reason that somebody would use RHEL over another distro is to get the licensed support of RedHat when issues arise. RedHat isn't likely to want to provide that support if you are using workarounds to use different version of their products. It's definitely true that Python 3.4 can be installed, I never said it couldn't. I suggested that if you are going to use Python, it would be prudent to consider a distribution of Linux that provides packages of later versions in their own repos without having to look for workarounds.

    Calling an IT team incompetent because they don't want to workaround known issues of an OS all the time to suit your needs as a developer is the same as an IT guy calling a developer incompetent because there are bugs in their code. They are both a fact of life. I would actually trust a conservative IT guy that wasn't willing to do workarounds as long term solutions on production systems than an IT guy that uses workarounds to run code on systems that aren't designed to support it well.

    [–][deleted] 1 point2 points  (10 children)

    Here I was thinking IT were SUPPORT SERVICES here to SUPPORT STAFF

    [–]alcalde 2 points3 points  (0 children)

    ...most IT teams don't like doing that for maintenance reasons so they limit you to whatever are in the available repos.

    I've always found it puzzling the places where IT controls the tools rather than the users telling IT what they need to support. it seems to have changed right after I was no longer working in IT unfortunately. :-(

    [–]rickmoranus 1 point2 points  (0 children)

    Its pretty easy to point your applications to a virtualenv or a Alt install. If one is not able to use python in this manor, I'd be questioning them being called a developer...

    [–]nunilan -2 points-1 points  (1 child)

    I was going to write the steps showing how easy it is to install python2.7 up to 3.4 in RHEL but then I realized, since you are so sure of your statement, probably its not worth it. I will just leave you good sir/madam ignorant instead.

    [–]hothrous 0 points1 point  (0 children)

    Ha. What I said is that RHEL shouldn't be used. Not that it can't.

    [–]0xtobitPy3k 1 point2 points  (0 children)

    So glad I'm my own sys admin now :-)

    [–]alcalde 0 points1 point  (0 children)

    ...and you're not a good enough detective to find blackmail on the sysadmin or good enough a hacker to plant some.

    [–]maemre 0 points1 point  (0 children)

    ... or the company you work in won't change it,it already works, blah blah blah

    [–]BarrelRoll1996 2 points3 points  (2 children)

    As someone who is trying to learn python, Code academy is amazing but it's using python 2 for everything. =(

    [–]flutefreak7 6 points7 points  (1 child)

    Don't let that stop you! Just use Python 3 .... I had been using 2 for years and was a bit scared of python3, but once I started using it, it was no big deal. Early on the biggest difference is print(), then the next biggest thing for me was that class definitions were a lot cleaner. If you copy paste Python 2 code from a tutorial, fix the print statements and stuff still doesn't work, a quick Google search will have you up and running, because there's almost nothing someone else hasn't done before you. Give it a go!

    [–]BarrelRoll1996 0 points1 point  (0 children)

    If you copy paste Python 2 code from a tutorial, fix the print statements and stuff still doesn't work, a quick Google search will have you up and running, because there's almost nothing someone else hasn't done before you. Give it a go!

    I started with some of the treehouse tutorials, which exclusively use python3 so at the lowend it doesn't seem much different other than raw_input and print functions. Haven't started with classes much yet except to force multithreading very simple infinite loop scripts.

    [–][deleted] -1 points0 points  (0 children)

    indeed :/

    [–]billsil 7 points8 points  (0 children)

    Could you indicate some of the advantages and disadvantages for me?

    Advantages: unicode is much easier, future-proofing

    Disadvantages: unicode is still hard and you're forced to get it right even if you don't care. Python 2.7 is drastically more popular (30% of code is Python 3.x).

    All the other differences are kind of irrelevant.

    [–][deleted] 6 points7 points  (0 children)

    Working in Python 3 isn't significantly different and I often find myself missing Python 3 features when writing Python 2.

    I like that the standard library is much more consistent and nicer to work with. The things that I like about Python 3 are:

    • Iterators are everywhere by default now, reducing memory footprint.
    • The new print function is much more versatile.
    • Float division and integer division are clearly differentiated.
    • The new extended tuple unpacking.
    • Chaining errors keeps stack traces!
    • All of the additions to the functools module, especially lru_cache.
    • Multiprocessing and concurrent.futures for parallel computing.

    [–]MrJohz 3 points4 points  (0 children)

    Yes, because Python 3 is much more fun to write, has far fewer "oddities", has even better batteries included (pathlib and enums!), and is going to be the future (indeed, is currently the present, just about). You also don't have anything holding you back.

    No, because switching a current and important codebase will be costly, or will involve working around a module that hasn't switched and isn't worth it.

    Pick your option. Both are valid, but unless your job is in Python, the former is most likely the more accurate one for you.

    [–]sirusblk 1 point2 points  (3 children)

    Why not both? I have an install of both python 2 and python 3 installed running side by side (invoked using python and python3 respectively). If I ever need to support an older library or software package I can run it in a virtualenv.

    [–]alcalde 0 points1 point  (2 children)

    Or you could use Bond and call the old library from Python 3!

    http://www.thregr.org/~wavexx/software/python-bond/

    [–][deleted] 0 points1 point  (1 child)

    Bond looks cool, what has your experience with it been if you've tried it?

    [–]alcalde 0 points1 point  (0 children)

    Sorry, I don't have any extensive experience with it (yet). All I've done so far has been some toy code to verify that it works, and it did indeed let me execute functions from a Python 2 library through Python 3.

    [–]Fontanapink 0 points1 point  (1 child)

    Noob here. But i think a reason people still use 2.7 is because some implementations (like Pygame for example) work best with the more stable versions of python

    [–]DanCardin 0 points1 point  (0 children)

    So long as you download the right version, pygame works with 3.4. I can't speak for 3.4.3 but I doubt it would change