4 ms·
I started in Python, as a Biologist (hooray for Jupyter-lab, coding so visually, in small steps, with output just there is so great when starting to learn Pytho
by teekert 4y ago
I started in Python, as a Biologist (hooray for Jupyter-lab, coding so visually, in small steps, with output just there is so great when starting to learn Python). I ventured into other languages every now and then. For example I tried to make an Android app in Kotlin that gets info from some API. I expect something like this but with more brackets everywhere:
import request
data = request.get(https://some.api/get_some_json)
some_value_I_want = data['dig']['into']['nested_structure']
I didn't get it to work at all, I was lines and lines of code into the program when I didn't even get to see any returned values.
Also, say I want to make a nice plot of some tabular data (.tsv), I do:
import pandas as pd
import seaborn as sns
data = pd.read_csv('some_file.tsv', sep='\t')
pd.melt(data, value_vars=['s', 'max_vms'], id_vars=['sample', 'process', 'N'])
g = sns.FacetGrid(data=data, col='process', row='variable', hue='sample', sharey=False, margin_titles=True)
g.map(sns.barplot, 'sample', 'value', order=data['sample'].unique())
Boom, what a plot (or large grid of plots actually), so much information. Can anyone show me how to do this in some other language (but R)? Idk, maybe I'm just not so smart, I just learned to program at 35 after always being a biologist, but any venture into any language has me thinking: Why does this have to be so complicated?
(Btw, I'm putting 4 spaces in front of the code, why is it not rendered as code?)
When I just started I used Python to read, sort and transform images and output them to a PowerPoint file. One can use CSS like synthax to format the slides. Boom PPT with 120 slides with images and data from some Excel file that convinced a lot of people with a lot of data that fluorescent images next to H&E stains + metadata can be nice. Is it the best way to present such data? Meh. But man was it cool and easy and time saving.
- ihatepython 4y agoThis isn't really programming though. This is just calling out to seaborn and pandas with an unpleasant interface (Python).
- teekert 4y agoOk, then I'm not programming. Call it anything you want, I call it "Being productive." Or, "Saving on time spent clicking around in Excel." or "Automating the boring things." And I find it to be quite pleasant. Maybe it also doesn't help that out there, in the C++, Rust, Javascript, Go world I'm going to run into people with usernames like "ihatepython".
- polotics 4y agoDon't feed the trolls! Case in point, this is a quote: quote_from_user_ihatepython == """ ihatepython 1 day ago | parent | context | prev | next [–] | on: Moscow Metro launches longest metro circle line You realize that the Nazis still exist and are Ukrainian, right? """
- trymas 4y agoSometimes I wish for "block" function in HN for such trolls (I really hope it's no-life troll working for 5 rubles per comment and not a real person with genuine hateful opinions like that).
- dagw 4y agoThis isn't really programming though. It is however what a lot of people who 'program' at work do every day. Python actually lets working professionals solve real problems they actually have at work quicker and easier than any other programming language.
- UncleEntity 4y agoIronically, TFA claimed there are a bunch of people “not programming” in python getting real work done out there. But, with a user name like that, I know I’m just wasting my time responding to you.
- vgatherps 4y ago"That's not programming, that's just calling libc with an unpleasant interface"
- DeathArrow 4y agoYour examples don't depend on the language but on the libraries. You can be as simple and concise in most languages, provided the libraries let you, instead of needing to add boiler plate. But what if your web request fails? Do you deal with it in time or use some_value_I_want which might contain junk?
- UncleMeat 4y agoThis is just a property of having libraries. If you've got the same libraries in Java then the code looks identical except that you stick to word "var" in front of lines 4 and 6 and you don't have named arguments. Python does have a great data processing ecosystem. But that isn't really a property of the language.
- pbourke 4y agoCreating a new venv, installing a few needed libraries that you know the names of with a simple command and writing a quick low-ceremony script that uses those libraries is frictionless in Python. Doing that repeatedly in nearly every other major language is not as easy. Some languages have a good integrated tool chain (Rust, Go) but are not as approachable and forgiving. Some are approachable but lack the friction-free story for locating and installing 3rd party dependencies.
- teekert 4y agoPoetry is indeed very nice for that. Bit of a learning curve but then very easy to push packages to PyPI or internal things like Artifactory.
- sethrin 4y agoThe most similar language to Python is Ruby, not Rust or Go, and Ruby is better at the things you've listed. Which would bring us back to the previous point that it's not actually about ease of use. Someone else identified Ruby's fatal flaw as not having good C tooling, and I think that's probably accurate.
- mixmastamyk 4y agoRuby has odd, once unique syntax that looks strange to anyone raised on C-like syntax, including js and java. Python is similar, simply removing redundant braces. So no ruby was not better at things most folks care about, i.e. being easy to learn.
- 4y ago
- pharmakom 4y agoI think you are confusing familiarity with ease of use.