Live data from Hacker News

Ask HN: Why you use python most?

news.ycombinator.com

1–10 of 39 posts

Re: Ask HN: Why you use python most?

#2
Python used to be my go to language. For me it was clear, easy to read, had a lot of great packages. Trying ideas out in the REPL was handy. (I've since mostly abandoned it for golang, and wonder how any of my Python ever worked considering how many silly mistakes the compiler catches).

Re: Ask HN: Why you use python most?

#3

Python used to be my go to language. For me it was clear, easy to read, had a lot of great packages. Trying ideas out in the REPL was handy. (I've since mostly abandoned it for golang, and wonder how any of my Python ever worked considering how many silly mistakes the compiler catches).

Yeah, both Golang and Swift are direct descendants of Python, and it's sort of hard to justify a niche for Python now that Google and Apple have performant in-house versions.

I have to wonder if Go and Swift would've just been Python if Guido had put more attention on the Python VM (and been willing to make some compromises to accommodate improvements).

Now Python is stuck playing catch up. Discussion around removing the GIL is finally beginning to be taken seriously instead of considered hypothetical, optional type annotations are being added, etc., but it may be too little too late.

Re: Ask HN: Why you use python most?

#4
I'm in ops and python is pre-installed on debian and fedora so besides writing stuff in bash, python is my next best thing without installing other languages. I would like to do more advanced things in python but I don't have any big projects / automation in my head yet.

Re: Ask HN: Why you use python most?

#5

Python used to be my go to language. For me it was clear, easy to read, had a lot of great packages. Trying ideas out in the REPL was handy. (I've since mostly abandoned it for golang, and wonder how any of my Python ever worked considering how many silly mistakes the compiler catches).

Yeah, both Golang and Swift are direct descendants of Python, and it's sort of hard to justify a niche for Python now that Google and Apple have performant in-house versions. I have to wonder if Go and Swift would've just been Python if Guido had put more attention on the Python VM (and been willing to make some compromises to accommodate improvements). Now Python is stuck playing catch up. Discussion around removing…

if python is the language of ML and ML is the future, i dont think the snakes are going extinct.

Re: Ask HN: Why you use python most?

#6

I'm in ops and python is pre-installed on debian and fedora so besides writing stuff in bash, python is my next best thing without installing other languages. I would like to do more advanced things in python but I don't have any big projects / automation in my head yet.

How about moving any (all) calls to /usr/bin/ssh to run a script on a remote server? Like running deployment, upgrades, or creating home directories and mail folders for a new user? http://harpcaller.jarowit.net/ (https://github.com/dozzie/harpcaller)

Re: Ask HN: Why you use python most?

#7

I'm in ops and python is pre-installed on debian and fedora so besides writing stuff in bash, python is my next best thing without installing other languages. I would like to do more advanced things in python but I don't have any big projects / automation in my head yet.

ops is a great place for Python. How about backups? Backup monitoring?

Don't roll your own monitoring solution, but tie Python scripts into Nagios, etc..

Re: Ask HN: Why you use python most?

#8
Python is my go-to language and I write big batch jobs in it and profile them and use PyPy. I do it because it's so clean and concise.

Recent C++ with lambda and auto is much improved but still not nearly as productive as Python.

Likewise lambda has really made Java better, but lack of type inference really makes it clunky to write.

I really want a statically typed Python. But because I don't have it, I choose Python for the syntax over c++/Java even for performance critical code.

Re: Ask HN: Why you use python most?

#9
Python used to be my "main" language, but that was only due to familiarity. For most IO intensive tasks (especially networking), Python is not the best choice [0]. Recently I've been using nodejs with promises and async/await for heavy IO. I really like the productivity gains of Javascript's functional programming style, and the event loop lends itself well to network/IO intensive tasks. (I would prefer to use golang for this, but haven't gotten around to learning it yet)

Now I use python when it's the best tool for the job, where the "job" is a part of a project. My projects usually involve a combination of three languages: python, javascript (node and/or frontend), and bash scripting. The bulk of the code is node, but for scripts I use a combination of bash and python.

I use bash scripts for anything that involves piping data between processes, simple file I/O, backup scripts, etc. I prototype almost every script in bash. When it gets too complicated, or requires parsing a lot of data, I switch to Python (sometimes I even inline the Python in bash with heredocs).

In my experience, bash is usually the best tool for the job if the "job" involves invoking lots of shell commands and piping their outputs somewhere. Using Python to call shell commands is of course possible, but I find it to be much less readable than bash for that specific use case.

Nothing beats Python for parsing and manipulating data, which is why it can be so powerful when combined with bash. Here [1] is an example bash script I wrote in ~30 minutes that uses inline Python. It deploys schema from a JSON file to parse-server. Bash handles the raw IO of reading files, network requests, etc, but inline Python does the simple manipulation of the JSON files.

[0] I haven't worked much with python3 or async/await... but that looks promising (hah) for increased throughput. I've even seen some benchmarks inline with node.

[1] https://gist.github.com/milesrichardson/b30acef8827c53aae088...

Re: Ask HN: Why you use python most?

#10

Python is my go-to language and I write big batch jobs in it and profile them and use PyPy. I do it because it's so clean and concise. Recent C++ with lambda and auto is much improved but still not nearly as productive as Python. Likewise lambda has really made Java better, but lack of type inference really makes it clunky to write. I really want a statically typed Python. But because I don't have it, I choose Python…

[deleted]
Post reply on HN