Larry Hastings - Solve Your Problem With Sloppy Python - PyCon 2018

  Рет қаралды 41,258

PyCon 2018

PyCon 2018

Күн бұрын

Speaker: Larry Hastings
Stop writing crappy shell scripts-write crappy Python scripts instead!
Other talks will show you how to write clean, performant, robust Python. But that's not always necessary. When writing personal automation or solving one-shot problems, it can be safe (and fun!) to quickly hack something together.
This talk will show examples of problems suitable for this approach, scenarios where it's reasonable to cut corners, novel techniques that can help break a problem down, and shortcuts that can speed development.
Slides can be found at: speakerdeck.com/pycon2018 and github.com/PyCon/2018-slides

Пікірлер: 46
@AS-yh1fj
@AS-yh1fj Жыл бұрын
As an Engineer, I believe this is the right approach to coding.
@SecondSight
@SecondSight 6 жыл бұрын
I think this is kind of one of the most underrated uses of Python! In literally minutes you can automate a really dreadful chore in the most hacky way possible but it works perfectly still. Not everything has to have function docstrings, functions for every little thing and a super modular and "formal" structure. Python is perfect for quick and dirty experimentation due to its dynamic / flexible nature
@EdiFerreiranet
@EdiFerreiranet 2 ай бұрын
That's exactly the reason why python exists!!!! 🍺🐍
@Azcane
@Azcane 4 жыл бұрын
As someone who uses regex (to rename files) regularly, this seems like such a verbose and convoluted solution to the first problem. His mindset regarding sloppy code is great though.
@b2gills
@b2gills 3 жыл бұрын
I wrote the same thing using a singular Raku regex to match the filename. Which among other things meant that I didn't have to put the list of files into the program. gist.github.com/b2gills/826f4d0421c5956099d73df70c0bf97f
@cupajoesir
@cupajoesir 6 жыл бұрын
Another Larry Hastings video. Perfect!
@fadious_padious2711
@fadious_padious2711 6 жыл бұрын
Don't write shell scripts. Use this shell script to get ready for your Python script.
@EdiFerreiranet
@EdiFerreiranet 2 ай бұрын
No, subprocess it!!!!
@luciverse
@luciverse 6 жыл бұрын
"Why didn't you do a list comprehension?" "If you want to practice your list comprehensions, then go ahead." 👍 ALSO: ✨Exception List ✨ -> DOPE
@colpachino
@colpachino 6 жыл бұрын
Loved the way dude presents his topic.
@DeepSukhwani
@DeepSukhwani 4 жыл бұрын
Wow, great stuff. Thank you Larry Hastings 🙇🏻‍♂️
@kmn1794
@kmn1794 5 жыл бұрын
As a perfectionist, I appreciate this talk.
@techjutsu4066
@techjutsu4066 6 жыл бұрын
Excellent Talk, if you ever create a beginner to pro book with topics like these I would be one of the first to purchase, great stuff.
@10e999
@10e999 6 жыл бұрын
Tech Jutsu agreed
@jfr9964
@jfr9964 5 жыл бұрын
This guy has probably already made SkyNet just because he didn't want to rename some folders.
@EdiFerreiranet
@EdiFerreiranet 2 ай бұрын
@randywelt8210
@randywelt8210 6 жыл бұрын
What about Gilectomy 2018, CPython4 with Garbage Collection?
@habbab
@habbab 3 жыл бұрын
This guy is dropping serious knowledge for beginners here.
@medthehatta
@medthehatta 5 жыл бұрын
... never write shell scripts ... fstrings [are impressive] ... [we want] spaces in filenames ... always use the latest version of everything ... % as prompt string ... [ansible] what's that? I sense Larry has never been a sysadmin. (That said, I'm fully on board with the overall idea of the talk, but I found myself wincing constantly at some of the details)
@medthehatta
@medthehatta 4 жыл бұрын
@@humpingmushroom2658 nothing wrong with f strings, but if you've ever used Perl or bash extensively, they wouldn't appear to be such a killer feature
@b2gills
@b2gills 3 жыл бұрын
I like Raku for sys-admin / command line stuff. Small example gist.github.com/b2gills/93d1e2aa6583b95315b2 Those multi sub MAIN are different argument lists you could give it. The comments with #| are documentation comments that gets included in the USAGE message. If you called that like 「bytes --help」 (or anything else that doesn't match the arguments) it will give you this generated USAGE message: Usage: bytes -- the number of bytes on the clipboard bytes -- the number of bytes in a file bytes --stdin -- the number of bytes from stdin I used that a lot when I was writing code golfs regularly. I also translated the Python program in this video to Raku gist.github.com/b2gills/826f4d0421c5956099d73df70c0bf97f
@Zergosss
@Zergosss 5 жыл бұрын
Lovely guy. I'd love to have buddies like him.
@user-oq8ph9ee7k
@user-oq8ph9ee7k 5 жыл бұрын
impressive and funny presentation style
@michaelthomheadley
@michaelthomheadley 5 жыл бұрын
Fantastic
@ronaldokun
@ronaldokun 6 жыл бұрын
Genius!
@kurtmayer2041
@kurtmayer2041 5 жыл бұрын
i was actually already using your way of installing python to update blender before i watched this
@RoamingAdhocrat
@RoamingAdhocrat 3 жыл бұрын
spend the day embodying this conference and… would dearly love to meet the developer who designed an API where to end an address on 2021-04-01 you send `endDate: {year: 2021, month: 3, day:1}` now my problems are Worse was wondering why 1 in 12 were coming back with "invalid data error"
@fazlearefin7339
@fazlearefin7339 4 жыл бұрын
For the provision solution 17:10 I wrote some ansible playbooks which might be useful for installing everything from scratch: github.com/fazlearefin/ubuntu-dev-machine-setup
@japrogramer
@japrogramer 5 жыл бұрын
I don't like spaces, i use underscores. Escaping characters is evil.
@kevindong9672
@kevindong9672 5 жыл бұрын
This guy is almost as good as David Beazley.
@unperrier5998
@unperrier5998 4 жыл бұрын
This shell script bashing has to stop. Every language has its usage and shell scripts are perfectly fine. I've seen people replacing "shell script" with clojure programs in Jenkins, because they didn't like shell scripts. Like cloujure, python is not as suitable as shell scripts to certain kind of tasks. Jus learn to use shell scripts and you'll like it. Don't get me wrong I love python but I know where and when to use it.
@DanHaiduc
@DanHaiduc 3 жыл бұрын
How would you rename the songs? Would I have to learn sed or awk also?
@SreenikethanI
@SreenikethanI 2 жыл бұрын
heh shell script "bash"ing
@dmsalomon
@dmsalomon 2 жыл бұрын
Totally disagree, many tasks are better done with pure shell, because you can leverage tools like curl, zip and it's much easier than using requests. But once you need do anything more complicated than simple if or for loop, I agree that python will be better
@mmmhorsesteaks
@mmmhorsesteaks 6 жыл бұрын
Man too bad he quit doing the gilectomy...
@jorgegomes83
@jorgegomes83 6 жыл бұрын
That's exactly what I was thinking.
@magno5157
@magno5157 5 жыл бұрын
Too difficult.
@hp.ramesh
@hp.ramesh 4 жыл бұрын
Anyone that takes extreme positions like "here is a solution for all your problems" or "don't write shell scripts, shell is an awful language" is always wrong. DIdn't have to watch the rest of his rant. Every language has a purpose. Even so called the "best" language can produce crappy code in the hands of a bad programmer and the vice versa is true as well. Respect every language for what it offers that others don't.
@gustavoalexandresouzamello715
@gustavoalexandresouzamello715 3 жыл бұрын
I guess you missed the context in which his claim was made. To his goals, writing short automation scripts, shell turns out to be awfully bad.
Carl Meyer - Type-checked Python in the real world - PyCon 2018
32:10
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 20 МЛН
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 28 МЛН
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 33 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 96 МЛН
Why would a python programmer learn rust when there are no jobs in it
23:09
Become a bash scripting pro - full course
36:00
CODE IS EVERYTHING
Рет қаралды 48 М.
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 807 М.
Nature's Incredible ROTATING MOTOR (It’s Electric!) - Smarter Every Day 300
29:37
Kyle Knapp - Automating Code Quality - PyCon 2018
31:21
PyCon 2018
Рет қаралды 10 М.
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 20 МЛН