Live data from Hacker News

Python 3 in 2016

hynek.me

181–190 of 194 posts

Re: Python 3 in 2016

#181
post #74

I've done a lot of Python for many years and its all been Python 2. Python 3 seems to be a decent improvement, and if I was working on a Python 3 project, that would be fine. But when it comes to new projects, I struggle to find a compelling reason to use Python at all, when there are so many amazing languages now to choose from. With a new project you could choose Scala, Haskell, Clojure, Erlang (or Elixir) or Go. A…

> I struggle to find a compelling reason to use Python at all My issue is I always see Python as the Second Best choice for what I am doing. There is always a better tool for the job. The one thing going for Python is that it is such a generalist BUT when doing work I prefer the Right Tool for the Job approach. I seriously can't think of a job that Python does best.

> I seriously can't think of a job that Python does best.

For me personally it is the best choice for non-throwaway shell scripting once the scripts becomes more complex and/or long lived than a sequence of shell commands.

Python is part of the base install of just about every mainstream Linux distro, so in that regard its only real competitor is Perl.

Re: Python 3 in 2016

#182

Earlier quoted context omitted.

I seriously doubt 4 will include breaking changes, at least not to the semantics/syntax of the language itself. What python really needs in 4 is better unified package management and distribution support. They have a lot to learn from the Javascript and Ruby evosystems.

> I seriously doubt 4 will include breaking changes, If it doesn't, it shouldn't be 4.

You missed the second half of the quote.

Breaking changes to the language syntax/semantics.

I'd expect breaking changes to apply to core APIs and/or to external tooling as both could probably use some revision now that the fundamental issues with the language (ex utf8 support) are mostly fixed.

Re: Python 3 in 2016

#183

Earlier quoted context omitted.

https://glyph.twistedmatrix.com/2015/09/software-you-can-use...

That page dismisses py2exe, but I've used it successfully for over a decade. On unix it is as simple as: sudo pip install [package/repo]

Except, you often need a full compiler toolchain for all the c dependencies. Then you need to make sure you have the required header files. Then you try and deploy to a small EC2 instance and run out of RAM building lxml or similar.

Re: Python 3 in 2016

#184
post #44

Earlier quoted context omitted.

The "all async" model of Node kills it for practical programming compared to Python... And the worst thing is, Node/v8's JIT would kill Python in performance for a;; the kind of things people write Python scripts for, even if it run all synchronous. It would be nice if callbacks/promises/async-await were only optional and for network/web things, not for everything.

You can still use the "-Sync" versions of functions in the standard lib.

Yes, but not hundreds of thousands of npm libs.

Re: Python 3 in 2016

#185

Earlier quoted context omitted.

Yes but when you want to distribute a program at the end of the day, you don't want to have to bundle python with every release or ask the use to install it, which makes a lot of people choose python 2 since it is ubiquitous.

python 2 is not ubiquitous, it is not installed by default on Windows

YMMV, but in the past, I've found it fairly easy to just have windows users install python(x,y) for scientific computing purposes. It's huge, but afterwards, most things just work. Anaconda is also a good choice.

Re: Python 3 in 2016

#186
post #126

Earlier quoted context omitted.

Python is still king for really boring and maintainable scripts. I mean boring in the best way. Every Python script o read is clean and elegant. It's easy to follow and well organized. Python 3 doesn't seem to make it any better at this. In fact all Python3 does is annoy me. I never know when I need it or not, it never seems to be clear either. The fact that it's packaged as a separate entity (i.e. /user/local/bin/py…

Fundamentally, python3 fixes some of the serious WATs in python2 and makes it easier to write high quality and maintainable software. For a pretty quick overview take a look at: https://migrateup.com/main-difference-python-3/ Perhaps if python3 annoys you more than makes you say, "Hey, this prevents lots of latent bugs I might have easily shipped to production before, cool!", then you need to learn python a bit bette…

Sorry, maybe I was unclear. I haven't really started learning python yet. I read it, and could probably write it. I don't know the ins and outs of the language. I don't even think I've written anything more than "hello world" in python, although, I'm pretty sure that program was also valid Ruby -- so it might not even count.

What I was trying to say is that the portability of python3 is bad enough that it effects non-python programmers.

For example, sometimes I want to try a new vim plugin that's written in python. I install it, and it doesn't work. Great. Then I find out it's because OS X's python can't interpret it. So I install python3 (which has a different executable name, also annoying). All good, right? Wrong. Vim needs to be compiled with python3 support because the python extension is exclusive to python. Now I have to recompile macvim with

    brew install macvim --with-python3 && brew install python3
It's not a quick process at all. Especially when I'm just trying something out. This stuff happens with other tools I've wanted to use too.

It doesn't ruin my whole day or anything, but it's a bit irritating to have to manage several versions of an interpreter for a language I'm not even using that language in production. It doesn't help that I use several machines and VMs.

So yeah, I know exactly what is annoying about it.

Re: Python 3 in 2016

#187

I used to write a lot of personal Python scripts (ie ~/bin). I mainly did this because I seem to always screw up bash scripts and just can't remember all the conditional flags ie ([[-z ]] and error handling with bash for me has always been tricky. However in the last couple of years I have dropped Python in favor of Groovy in part because I know the JVM and its plethora of libraries so well. Groovy is a highly underr…

> I really don't have to worry if I write Groovy in a pre Java 5 (ie without generics)

Groovy has many incompatible changes between versions, esp from 1.8 to 2.0 but also 1.7 to 1.8, 1.6 to 1.7, etc. Many sites provide Groovy 1.8 as the default because no-one there wants to bother with upgrading.

Re: Python 3 in 2016

#188
post #183

Earlier quoted context omitted.

That page dismisses py2exe, but I've used it successfully for over a decade. On unix it is as simple as: sudo pip install [package/repo]

Except, you often need a full compiler toolchain for all the c dependencies. Then you need to make sure you have the required header files. Then you try and deploy to a small EC2 instance and run out of RAM building lxml or similar.

If your requirements are advanced, make packages on your dev box then deploy those:

https://nylas.com/blog/packaging-deploying-python

Re: Python 3 in 2016

#189
post #153

I don't understand the python2 vs python3 fuss. Maybe I'm not doing anything interesting enough, but I find it fairly easy to write code that runs in python >= 2.7 and python >= 3.3. If I was working in a python2-only code base, I would just baby-step it towards python3 compatibility. It doesn't have to be a complicated, disruptive task.

Things are a lot easier with recent versions of Python 3. Not spending more time on supporting 2/3 compatible codebases was a big mistake in my opinion. I think Guido had the idea that everyone was eventually going to run 2to3 and then be done with the conversion. There is too much Python 2 code out there for that to work. Python 2 was too successful and businesses have no inventive to convert working apps. The %-for…

Next step: bring back print.

For my code base, I'm mostly worried about division being different, which will introduce silent errors when integer types break down (or up?) into floats.

Re: Python 3 in 2016

#190
post #90

Earlier quoted context omitted.

If you are building an application which does a lot of machine learning and statistics, I don't see a better language than Python. It has so many libraries to use for it. Note, I love R, but I can't imagine building an application with it.

You can build apps with R, but the result will be the ugliest code you have ever seen. For me, R for research and prototyping, then Python for productionalizing.

Ugly isn't the problem. It is the poor error catching, erratic memory use, several ways to do one thing due to a lack of features in the standard libraries (regex), etc.
Post reply on HN