Тёмный
No video :(

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

PyCon 2018
Подписаться 21 тыс.
Просмотров 41 тыс.
50% 1

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

Опубликовано:

 

12 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 46   
@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 3 месяца назад
That's exactly the reason why python exists!!!! 🍺🐍
@AS-yh1fj
@AS-yh1fj Год назад
As an Engineer, I believe this is the right approach to coding.
@cupajoesir
@cupajoesir 6 лет назад
Another Larry Hastings video. Perfect!
@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
@DeepSukhwani
@DeepSukhwani 4 года назад
Wow, great stuff. Thank you Larry Hastings 🙇🏻‍♂️
@colpachino
@colpachino 6 лет назад
Loved the way dude presents his topic.
@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
@kmn1794
@kmn1794 5 лет назад
As a perfectionist, I appreciate this talk.
@fadious_padious2711
@fadious_padious2711 6 лет назад
Don't write shell scripts. Use this shell script to get ready for your Python script.
@EdiFerreiranet
@EdiFerreiranet 3 месяца назад
No, subprocess it!!!!
@jfr9964
@jfr9964 5 лет назад
This guy has probably already made SkyNet just because he didn't want to rename some folders.
@EdiFerreiranet
@EdiFerreiranet 3 месяца назад
@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
@randywelt8210
@randywelt8210 6 лет назад
What about Gilectomy 2018, CPython4 with Garbage Collection?
@habbab
@habbab 3 года назад
This guy is dropping serious knowledge for beginners here.
@Zergosss
@Zergosss 5 лет назад
Lovely guy. I'd love to have buddies like him.
@michaelthomheadley
@michaelthomheadley 5 лет назад
Fantastic
@user-oq8ph9ee7k
@user-oq8ph9ee7k 5 лет назад
impressive and funny presentation style
@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
@ronaldokun
@ronaldokun 6 лет назад
Genius!
@kurtmayer2041
@kurtmayer2041 5 лет назад
i was actually already using your way of installing python to update blender before i watched this
@fazlearefin7339
@fazlearefin7339 5 лет назад
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.
@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"
@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.
@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
@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
@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 4 года назад
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.
Далее
«K operatsiyasi» davom etadi: Kiyevning rejasi ma'lum
05:07
Kyle Knapp - Automating Code Quality - PyCon 2018
31:21