News for hackers. Stuff that matters.
Re:Show HN: tttfi – Middleware for IFTTT by sdoering on Monday July 17, 2017 @05:00PM (#14792218)
Legacy python nowadays? I really cannot understand why one would use legacy with a new project.

Sorry but I could understand if you had to maintain a legacy code base.

Re:Show HN: tttfi – Middleware for IFTTT by luke3butler on Monday July 17, 2017 @05:08PM (#14792287)
The entire project is 89 lines of ES6 JS. Python 2 was just used for four lines of example middleware.

You can write middleware in anything that's executable via a terminal window.

Re:Show HN: tttfi – Middleware for IFTTT by oxguy3 on Monday July 17, 2017 @05:03PM (#14792253)
Python2 is still what comes installed as stock on many distros. I know Fedora/CentOS ship with it, in part because the package manager Yum/DNF is based in Python2.
Re:Show HN: tttfi – Middleware for IFTTT by toyg on Monday July 17, 2017 @07:05PM (#14793038)
That's not even true anymore. From https://fedoralovespython.org/ :

   On Fedora, Python comes pre-installed with first class support for 
   Python virtual environments. It is ready for use straight out of the 
   box. No guessing package names, no installation, just dive in and go. 
   Look:
   [fedora]$ python3 -m venv env
   [fedora]$ . env/bin/activate
   (env) [fedora]$ python ...
Note the python3 ...

EDIT: wow, 4 downvotes for stating a fact that Fedora developers themselves are shouting from rooftoops. The Python3 hate is strong today.

Re:Show HN: tttfi – Middleware for IFTTT by OJFord on Monday July 17, 2017 @10:26PM (#14793887)
But what's the output of

    python --version
(note not python3)
Re:Show HN: tttfi – Middleware for IFTTT by maweki on Tuesday July 18, 2017 @02:42AM (#14794673)
PEP 394 says that python should point to python2 for the time being.

https://www.python.org/dev/peps/pep-0394/

Re:Show HN: tttfi – Middleware for IFTTT by toyg on Tuesday July 18, 2017 @03:20AM (#14794829)
Yup, and it will be reviewed and likely changed at some point:

   This recommendation will be periodically reviewed over 
   the next few years, and updated when the core development
   team judges it appropriate. 
So it's likely that at some point between here and 2020, or in 2020 at worst, the recommendation will change.

IMHO Python 3 has now reached a level of maturity and backward-compatibility where it can safely take over as system python. It's now shipped by Fedora, which means the next RHEL will also ship it. Updating old scripts should mostly be a matter of grepping and shebanging from python to python2, and there is now no point in procrastinating further with this move.

Re:Show HN: tttfi – Middleware for IFTTT by Freak_NL on Tuesday July 18, 2017 @02:44AM (#14794679)
Any proper Python script starts with a shebang:

    #!/usr/bin/env python3
This works on all modern Linux distributions today.
Re:Show HN: tttfi – Middleware for IFTTT by OJFord on Saturday July 22, 2017 @06:36PM (#14829814)
Yes, and if you write it like that, the output of `python --version` has direct consequences for the remainder of the script.
Re:Show HN: tttfi – Middleware for IFTTT by twblalock on Monday July 17, 2017 @05:18PM (#14792342)
The majority of the Python programmers I know still use Python 2 for new projects.
Re:Show HN: tttfi – Middleware for IFTTT by mod on Monday July 17, 2017 @05:41PM (#14792502)
Out of curiosity, how recently have you touched on that?

I was one of them until the last couple of months. I think moving to 3 now makes sense, and it's pain-free in my experience.

In 2016 I hadn't made the move yet. And as recently as a couple of months ago, sometimes py2 was still the choice (for instance, Amazon Lambda didn't support 3 yet).

Re:Show HN: tttfi – Middleware for IFTTT by foxylad on Tuesday July 18, 2017 @12:17AM (#14794234)
And Google Appengine is stuck on Python 2.
Re:Show HN: tttfi – Middleware for IFTTT by tuxxy on Monday July 17, 2017 @06:47PM (#14792902)
I don't believe this for a minute.

Sure, lots of Enterprise apps use Python 2 because that was what they could build with.

I'm a Python developer and I don't know anyone who doesn't use Python 3 by default.

I understand this is purely anecdotal, but it seems outlandish to say that Python devs mostly use Python 2.

Re:Show HN: tttfi – Middleware for IFTTT by fermuch on Monday July 17, 2017 @07:34PM (#14793212)
This is still anecdotical, but most python developers I know would chose py2 if given the choice. It's what they know, and they don't want to change semantics even if it's just changing how you write prints.
Re:Show HN: tttfi – Middleware for IFTTT by anilakar on Tuesday July 18, 2017 @03:49AM (#14794941)
Counter-anecdote: Not a single developer I know wants to touch Python 2 after trying to get Django to work reliably with Unicode.

Then again, if your language is completely representable with US-ASCII, you might not have experienced the pain caused by having to unit test pretty much all string operations in your code.

Re:Show HN: tttfi – Middleware for IFTTT by jsnathan on Tuesday July 18, 2017 @04:24AM (#14795078)
I like to trot out this link whenever this comes up [1].

[1]: https://semaphoreci.com/blog/2016/11/11/python-versions-used...

Re:Show HN: tttfi – Middleware for IFTTT by twblalock on Monday July 17, 2017 @11:43PM (#14794141)
> I understand this is purely anecdotal, but it seems outlandish to say that Python devs mostly use Python 2.

Then I guess it's a good thing I didn't say that. I said the majority of the ones I know use it.

Re:Show HN: tttfi – Middleware for IFTTT by serf on Monday July 17, 2017 @07:15PM (#14793091)
the only devs I know that use python2 are ones that stuck having to do so because no one has put the legwork in to port a library over to py3.
Re:Show HN: tttfi – Middleware for IFTTT by kamikat on Monday July 17, 2017 @09:06PM (#14793642)
I've re-written sample script in pure shell code :P

The idea is that I'd like to write little to make little things work with IFTTT. Py2 is just enough to do a lot while keeping things casual and of fun. Py3 is too serious to me and shell script just awful...

Happy hacking.