News for hackers. Stuff that matters.
Re:Never run ‘python’ in your downloads folder by coldtea on Sunday August 23, 2020 @12:21PM (#24252958)
>I am convinced it is only "beginner friendly" because of how much folks insist it is so.

Well, also because you can open a text editor and have a script with very straighforward code in 10 minutes...

Re:Never run ‘python’ in your downloads folder by cortesoft on Sunday August 23, 2020 @12:43PM (#24253150)
There are quite a few languages that can do that... perl, ruby, bash
Re:Never run ‘python’ in your downloads folder by svachalek on Sunday August 23, 2020 @01:04PM (#24253320)
This is an... interesting idea of "straightforward" in the case of bash and to a lesser degree, perl (although I hear perl 6 is nicer).
Re:Never run ‘python’ in your downloads folder by tyingq on Sunday August 23, 2020 @04:19PM (#24254978)
Raku is even more expressive, so if you're unhappy with Perl 5 for readability reasons, there no improvement there.
Re:Never run ‘python’ in your downloads folder by lizmat on Monday August 24, 2020 @01:45PM (#24263221)
Please note that Perl 6 has been renamed to Raku (https://raku.org using the #rakulang tag on social media). And yes, it is nicer :-)
Re:Never run ‘python’ in your downloads folder by rpastuszak on Sunday August 23, 2020 @06:36PM (#24255882)
How about node/es?
Re:Never run ‘python’ in your downloads folder by Sebb767 on Sunday August 23, 2020 @06:06PM (#24255695)
And php, which is also a really beginner-friendly language. In fact, not needing the big toolchain at the beginning helps experimenting a lot and is probably one big factor of what made both of them take off so much in that niche.
Re:Never run ‘python’ in your downloads folder by dragonwriter on Sunday August 23, 2020 @04:26PM (#24255013)
Perl and Ruby have even more common use of “magic” than python.
Re:Never run ‘python’ in your downloads folder by sitkack on Sunday August 23, 2020 @11:36PM (#24257342)
As a long time (97) user of Python who completed a couple katas in Ruby, Ruby has _regular_ magic, as in it is predictable. Python magic is adhoc.
Re:Never run ‘python’ in your downloads folder by dragonwriter on Monday August 24, 2020 @02:19AM (#24257951)
As a long time user of both Python and Ruby, Ruby has plenty of ad hoc magic, at least as much of Python, though it's likely you won't see that as much in whatever language you are less familiar with.
Re:Never run ‘python’ in your downloads folder by Hamuko on Sunday August 23, 2020 @05:06PM (#24255293)
Can you do straightforward JSON download and processing in bash?
Re:Never run ‘python’ in your downloads folder by heavyset_go on Sunday August 23, 2020 @05:52PM (#24255584)
You can go a long way with jq, pup and similar tools.

As an exercise, I used Bash to build scraping and download scripts for about a dozen websites. I found that I only needed to dip into Python when doing complicated operations on strings, or I needed access to data structures.

I actually liked the approach of using Bash first for scraping, because it gave me direct access to Bash's superior IPC and concurrency constructs. I could plug in a Python script into the pipeline and it wouldn't be any different than interacting with another Bash process.

Re:Never run ‘python’ in your downloads folder by samatman on Sunday August 23, 2020 @07:25PM (#24256165)
I do most of my straightforward JSON download and processing in bash. Well, in fish.

As everyone else replying to you indicated, I use jq for it. But when I type `curl http://example.com | jq .`, I'm programming in fish.

Granted, when I want to do something more complex and durable, I'm likely to reach for, yes, python. But nearly as often, I build up a moderately complex jq command, and set an alias to it.

Re:Never run ‘python’ in your downloads folder by dylan604 on Sunday August 23, 2020 @05:51PM (#24255577)
Is that the sole criteria for a scripting language to be useful?
Re:Never run ‘python’ in your downloads folder by edgyquant on Monday August 24, 2020 @12:22AM (#24257504)
I'd say yes being able to parse JSON is a requirement in today's world
Re:Never run ‘python’ in your downloads folder by Shared404 on Sunday August 23, 2020 @06:40PM (#24255899)
Not generally, but perhaps it is for their use case.
Re:Never run ‘python’ in your downloads folder by buddhiajuke on Sunday August 23, 2020 @06:50PM (#24255960)
With an util like jq, yes.
Re:Never run ‘python’ in your downloads folder by nnt38 on Tuesday August 25, 2020 @07:48AM (#24270370)
curl | jq