- 1 099
- 3 275 881
anthonywritescode
Registrace 17. 03. 2017
Various videos about programming and related topics. Most videos will feature open source software and programming best practices. For now, most videos will deal with python.
All slides and associated code are on github: github.com/anthonywritescode
All slides and associated code are on github: github.com/anthonywritescode
PEP 696 is a huge quality-of-life improvement (intermediate) anthony explains #576
short and sweet! death to `Generator[T, None, None]` \o/
- Generator[T, S, R] typing: czcams.com/video/DTegfCNAXoM/video.html
playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html
==========
twitch: twitch.tv/anthonywritescode
dicsord: discord.gg/xDKGPaW
twitter: codewithanthony
github: github.com/asottile
stream github: github.com/anthonywritescode
I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!
- Generator[T, S, R] typing: czcams.com/video/DTegfCNAXoM/video.html
playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html
==========
twitch: twitch.tv/anthonywritescode
dicsord: discord.gg/xDKGPaW
twitter: codewithanthony
github: github.com/asottile
stream github: github.com/anthonywritescode
I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!
zhlédnutí: 7 149
Video
`x: float = False` is a valid annotation??? (intermediate) anthony explains #575
zhlédnutí 4,1KPřed 21 dnem
today we talk a bit about the numeric tower in mypy's type system and a few quirks that result from it. - NotImplemented vs NotImplementedError: czcams.com/video/GSBqmYUnBdk/video.html - NotImplemented is a bool?: czcams.com/video/5XBs_fM3Nac/video.html playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: twit...
typing the untype-able with mypy plugins (advanced) anthony explains #574
zhlédnutí 7KPřed měsícem
today I show an approach to make mypy understand a very dynamic pattern with a plugin! playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywritescode I won't ask for subscriptions / likes / comments in videos but it reall...
typing decorators sucks! here's an easier way (intermediate) anthony explains #573
zhlédnutí 10KPřed 2 měsíci
ParamSpec / TypeVar / Callable oh my! this skips all of that and gives a simple easy-to-reuse decorator (and more!) - how @ contextmanager works: czcams.com/video/nr_q2y0qxFg/video.html - contextmanagers the easy way: czcams.com/video/ucGpcA9r4hU/video.html playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: ...
adding test == others fail??? (intermediate) anthony explains #572
zhlédnutí 4,1KPřed 2 měsíci
today I show off a very strange bug in `black`'s testsuite and then how I found the problem which led to the fix! - what is test pollution? czcams.com/video/FRteianaPMo/video.html - fixing a flaky test with detect-test-pollution: czcams.com/video/w5O4zTusyJ0/video.html - debugging a sentry test pollution: czcams.com/video/YEIeKdBmuUY/video.html playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug...
training a custom object detection model from scratch (yolov8) (intermediate) anthony explains #571
zhlédnutí 2,9KPřed 3 měsíci
today I walk through my adventures training a custom object detection model (for identifying pokemon)! playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywritescode I won't ask for subscriptions / likes / comments in vid...
am I vulnerable to black's CVE? (2024-21503) (intermediate) anthony explains #570
zhlédnutí 6KPřed 4 měsíci
today we walk through an analysis of black's recent CVE regarding regular expressions and whitespace! It's marked "Medium" with "Network" attack vector and we'll show whether it matters or not! - what is reDOS: czcams.com/video/ECbls57_3jE/video.html playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: twitter...
using git bisect to find a bug in nodejs (intermediate) anthony explains #569
zhlédnutí 4,6KPřed 4 měsíci
today I walk through how I figured out a zip corruption problem and when it was introduced in nodejs! - how to use git bisect: czcams.com/video/C2C7FTI8nB4/video.html playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywr...
using the 3ds touch screen without touch!?
zhlédnutí 1,9KPřed 5 měsíci
today I show how I automated the 3ds including the touch screen! - my original 3ds automation project: czcams.com/video/LvqmdC5YjXw/video.html playlist: czcams.com/play/PLWBKAf81pmOYZoIyNPAnR7i56KV1JaRr0.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywritescode I won't ask for...
my thoughts on ruff
zhlédnutí 12KPřed 5 měsíci
short and (bitter)sweet. playlist: czcams.com/play/PLWBKAf81pmOZEPeIV2_pIESK5hRMAo1hR.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywritescode I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you...
py-spy saved our python 3.11 rollout (intermediate) anthony explains #568
zhlédnutí 9KPřed 5 měsíci
today I show how I solved a perplexing performance degradation using a sampling profiler: py-spy! playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywritescode I won't ask for subscriptions / likes / comments in videos b...
using memray to debug (and fix) a memory leak in krb5! (advanced) anthony explains #567
zhlédnutí 5KPřed 6 měsíci
today I show how I utilized memray to both find, debug, and ultimately fix a memory leak in krb5 sadly this was not the leak I was looking for though! playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywritescode I won't...
ONE TERABYTE of RAM saved with a single line of code (advanced) anthony explains #566
zhlédnutí 55KPřed 6 měsíci
today I show off a small change I made at work with huge impact and explain how it works! - fork vs spawn czcams.com/video/hzBtsDPJ1dM/video.html - python sucks at copy-on-write czcams.com/video/sdmcCQ7Em04/video.html playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: gith...
git: inline diffs with --word-diff! (intermediate) anthony explains #565
zhlédnutí 3,3KPřed 7 měsíci
today I show a tiny tip when working with patches in `git` (such as with `git diff` or `git log -p`) to show inline differences instead of full line differences playlist: czcams.com/play/PLWBKAf81pmOaP9naRiNAqug6EBnkPakvY.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: codewithanthony github: github.com/asottile stream github: github.com/anthonywritesco...
I modded a gameboy advance (and a wii!) to get the rarest shiny pokemon! (jirachi?)
zhlédnutí 1,5KPřed 7 měsíci
today I show off how I soldered wires to a GBA and a wii and then coordinated them in software to reset for a shiny jirachi! - code: github.com/asottile/nintendo-microcontrollers - more about the method I used: czcams.com/video/4rhHSKE1mwo/video.html playlist: czcams.com/play/PLWBKAf81pmOYZoIyNPAnR7i56KV1JaRr0.html twitch: twitch.tv/anthonywritescode dicsord: discord.gg/xDKGPaW twitter: twitter...
prefer tuples to lists! (intermediate) anthony explains #564
zhlédnutí 9KPřed 7 měsíci
prefer tuples to lists! (intermediate) anthony explains #564
I imported my pokemon collection to sqlite using cv!
zhlédnutí 2,5KPřed 7 měsíci
I imported my pokemon collection to sqlite using cv!
pesky reDOS and python 3.11 (intermediate) anthony explains #563
zhlédnutí 3,6KPřed 8 měsíci
pesky reDOS and python 3.11 (intermediate) anthony explains #563
new 3.12 f-strings syntax! (intermediate) anthony explains #562
zhlédnutí 6KPřed 8 měsíci
new 3.12 f-strings syntax! (intermediate) anthony explains #562
NEW generic / alias syntax for python 3.12 (PEP 695) (intermediate) anthony explains #561
zhlédnutí 10KPřed 8 měsíci
NEW generic / alias syntax for python 3.12 (PEP 695) (intermediate) anthony explains #561
what is a BOM (byte-order-marker) (intermediate) anthony explains #560
zhlédnutí 3,5KPřed 8 měsíci
what is a BOM (byte-order-marker) (intermediate) anthony explains #560
I don't use backslashes (with one exception) (beginner - intermediate) anthony explains #559
zhlédnutí 7KPřed 9 měsíci
I don't use backslashes (with one exception) (beginner - intermediate) anthony explains #559
git: --first-parent (intermediate) anthony explains #558
zhlédnutí 3,2KPřed 9 měsíci
git: first-parent (intermediate) anthony explains #558
don't delete from pypi! (yank instead) (intermediate) anthony explains #557
zhlédnutí 3,4KPřed 9 měsíci
don't delete from pypi! (yank instead) (intermediate) anthony explains #557
the system design interview (intermediate - advanced) anthony explains #556
zhlédnutí 9KPřed 9 měsíci
the system design interview (intermediate - advanced) anthony explains #556
docker: connecting to localhost outside the container (intermediate) anthony explains #555
zhlédnutí 34KPřed 10 měsíci
docker: connecting to localhost outside the container (intermediate) anthony explains #555
stopping xargs early (intermediate) anthony explains #554
zhlédnutí 4KPřed 10 měsíci
stopping xargs early (intermediate) anthony explains #554
debugging a sentry test pollution! (intermediate) anthony explains #553
zhlédnutí 4,1KPřed 10 měsíci
debugging a sentry test pollution! (intermediate) anthony explains #553
automating the nintendo 3ds (hardware mod)
zhlédnutí 2,2KPřed 10 měsíci
automating the nintendo 3ds (hardware mod)
what is `Symbol` in js (intermediate) anthony explains #552
zhlédnutí 4,4KPřed 10 měsíci
what is `Symbol` in js (intermediate) anthony explains #552
Seems like the performance is not worth it compared to headache of configuring it in CICD 😅😅
What about PDM?
I actually had this happen on a real production IT system that I was working towards taking over the management of. I was working for an outsourcing company, and the system was in production and being operated and managed by the application vendor. The reason we hadn't taken it over was because there was zero operational documentation and zero scripted operations. So the vendor was operating it manually based on instructions scribbled on a scrap of paper. These instructions said: 1. "cd /tmp"; 2. "rm -yr *"; 3. "reboot". Unfortunately, one evening having done step one, the operator received a telephone support call and as part of answering that he went root (presumably with "sudo -i" which put him back in the root directory). When he finished the call he executed steps 2 and 3 without exiting root thus doing EXACTLY what this video shows. D'UH!!! To cap it all, it then turned out that the system backups hadn't been working either and hadn't been tested and it took them 2 or 3 weeks to rebuild this production system. DOUBLE D'UH!!!!!! I might add that this was one of two similar screw ups (the other resulting from deletion of the production SQL database) at the end of a disastrous fixed price application development where the system has already been rejected and redeveloped from scratch and where the initial go live was abandoned twice, once because an untested system timezone change caused it to fail, and once because the system has never been tested on a production sized database, and several missing indexes resulted in use response times on a linked production customer call healing system going from 1sec to over 30mins. Put simply a fiasco from start to finish from a MAJOR MAJOR software house.
Hi , I wanna shred my picture in my phone but does have an error , permission denied , how can I solve that? Thanks
Oh, I had missed to understand that leaving the slowest task last made so that we couldn't schedule anything else in the meantime, since there isn't anything else to begin with
Interesting! Out of curiosity, I tried creating a directory named '-', and found that it cannot be accessed using 'cd -'. Therefore, it can only be accessed using a longer relative or absolute path.😆
Very well-said Anthony -- have you ever had the chance to talk to David Cramer himself ? I can see his name as one of the investors 😬
The CPython implementation detail about object address reuse mentioned in *explains **#343* makes a prominent appearance in this episode! I can't help but notice it since obtaining that bit of knowledge.
Oh, nice)
\o/ ... That's cool!
Thanks!
PDM is the way
I thought it was true triple yoru
you did the project very good!!! i really appreciate it , but i have one bugs when working on your project : that it appears Connecting to programmer: . avrdude: butterfly_recv(): programmer is not responding Found programmer: Id = "1023 �"; type = Software Version = 1.0; Hardware Version = 2.3 avrdude: error: buffered memory access not supported. Maybe it isn't a butterfly/AVR109 but a AVR910 device? avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check. avrdude: error: programmer did not respond to command: leave prog mode avrdude: error: programmer did not respond to command: exit bootloader i hope you can help me to take it look, really thanks
I have a question in pycharm I have interpreter 3.10 do I have to check the checkbox code inspections have incompatible with other Python versions then it produces red underlines with like tkinter it says incompatible with Python 2.7 version? Thanks
So there is no way to use braces like in Java
Thanks, I was trying to learn this from a book and I needed to see it in action.
Pog
Something comparing submodules with subtrees would be nice.
Thanks! What kind of keyboard/mouse set up is that? It looks useful.
I typically watch videos at 2x speed, but this time I'm watching at 0.5x speed.
.5x speed but only 5% of the time?
Hi Anthony. Thank you for such great content. It’s really hard to find intermediate/advanced python topics on youtube because most of the content is created for beginners and there’s no point to watch it if you already have at least some production experience. Keep up the great work. I’d like to ask you to record a video about Python memory management, how to write cpu/ram efficient code, tips & tricks, what to avoid and all python memory-cpu-related stuff, memory leaks, profiling, etc. (I watched a video about preloading & gc.freeze() it was really fun and cool stuff you did.)
it's difficult to pinpoint a strategy specifically -- at least when writing pure python you don't really have much control over it other than not globally caching things forever (and not using buggy C libraries!) -- that said here's a few others I've done about memory (explains videos are collected at github.com/anthonywritescode/explains) - using memray to debug a memory leak in krb5: czcams.com/video/bw5AHdZA7e4/video.html - don't lru_cache a method: czcams.com/video/sVjtp6tGo0g/video.html - fixing a 9GB memory leak in cargo: czcams.com/video/uxJhAXdBlbc/video.html
Maybe an obvious question, but why were there two None values in the first place?
Generator can yield, return and accept value using .send() Hence three typings for each of those possibilities
I cover this in the video linked in the description in more detail as well!
oh finally!!!!!!
Yeah, that always caused eye cancer.
That's fantastic. It's ugly and most people don't understand the other 2 anyhow
Is it possible to achieve git like functionality here? Like creating commit through one api, then using push api to push commits to github.
that is... exactly what this video is?
wow that is great. Always found that annoying.
Is there a difference between importing Generator from collections.abc and typing?
typing.Generator is a deprecated alias to collections.abc.Generator
@@iamcurrentlypooping thanks! I was recently going through the docs, and I don't recall seeing any deprecation warning, that's why I was confused. Looks I just overlooked it :-P
This is cool, this decorator-context manager equivalence reflects that a decorator what basically is doing is "managing" the "context" of the wrapped function and that a context manager is basically is "decorating" an annonymous IIFE. One really beautiful abstraction.
Love your energy in this one 😊 Indeed a nice QoL improvement 🎉
really cool, but it highlights how foreign type hints are to the core language
So excited about that change. I often violated the rule of maximum specificity in the return type and simply used a higher-in-hierarchy `Iterator[T]`, which is obviously not an equivalent: it was only suitable for cases where I didn't have to access `.send()`, `.throw()` or `.close()`; but that was the majority of cases. Nevertheless, so cool I can just use `Generator[T]` now. There are lots of other use cases, for example `textual.App[T]` with the `T` defaulting to `None`.
YESSSS!!!!! Generator[int,None,None] is just WHY?!
This could be true for Coroutine also
indeed! though I'm not sure Coroutine got the same treatment :(
Everytime I write something else than python I wish it was python. Unfortunately mypy is still not standard for most of the folks like typescript
This is my second favorite hackathon shirt! Eco Hack shirt finally beat it, but still a favorite. Very happy to see you still making these videos! CZcams has not put them in my feed for awhile.
alternative title: Nerd gets excited he doesn't have to type ", None" as often
it's true!
@@anthonywritescode isn't it True?
It was so fun to watch you get happy about this. 😀
696.... It is nice
Didn't understand much as I am still a beginner. But seems like they get rid of ugly (unnecessary) annotations. Thanks for demo.
annotations are beautiful, not ugly.
I never seen a grown man more happy than this, good addition btw lol
Generator[T, None, None] is one of those things that everyone knows about but most don't know why. It would be cool to have a video explaining what the other types are for
I have one! I forgot to link it in the description but it's there now!
This is exactly why I've always annotated my generators as Iterator[T]. Finally I can use Generator!
Cool, I have dozens of Generator[T, None, None] in my projects.
Hello, I was looking at your video channel. We may be helping a company that uses secure images to increase supply chain security and help cloud native development. Would you be willing to help try their software, make a video, and help show devs how to use their tools? This is not an offer, but just to start a conversation about your willingness to take on sponsorship. The video can be from 5 to 10 minutes long. You'd have a chance to look at their technology and decide if it's the type of software that you'd be interested in covering in your channel. Please provide us with your pricing.
Hello Hello, I seem to be having an issue where the pro micro isn't entering programming mode. It's the same one you have linked in the readme, I have tried attaching a button and using a headphone jack. But windows never makes the noise and the terminal repeatedly gives me: avrdude ser_send() OS error: unable to write: Resource temporarily unavailable avrdude butterfly_vfy_cmd_sent() error: programmer did not respond to command: leave prog mode and then getting stuck on: avrdude butterfly_vfy_cmd_sent() error: programmer did not respond to command: exit bootloader Is this anything you might have words of wisdom for?
you mentioned you're on windows -- are you working in a virtual machine like I am? you may need to add the usb device to the auto-attach list if you're using virtualbox (since the programming mode is a separate device itself) I've also had a similar error (though no idea if it's the same message) when I bricked a board -- though I would make sure to try a bunch of stuff first before getting a new one
@@anthonywritescode Alright, so the problem was entirely the auto-attach to vm thing. I've got it flashed now, shows up as a pokken controller and everything. That's my bad for missing something covered in the video. Thanks for your help.
Not implemented seemed kinda normal to me. Isn't not implemented usually a bottom type in other type systems?
I find the default stack level to be appropriate sometimes. For instance, during import time, if warning about some platform-specific idiosyncrasies related to the imported package in that environment.
even in that case it would still be better at level=2 to warn about the place that imported it rather than the module with the warning -- it's trivial to track down where it's coming from in that case
Hey, what if mix Protocol and TypeVar? Gave this a try and actually does not work. Example: ``` from typing import Protocol, TypeVar class IndexableProt(Protocol): def __index__(self) -> int: ... class C: def __index__(self) -> int: return 2 Indexable = TypeVar("Indexable", bound=IndexableProt) c = C() def print_indexable(i: Indexable): print("at i, val is: ", [1,2,3,4,5,6][i]) def print_indexable2(i: IndexableProt): print("at i, val is: ", [1,2,3,4,5,6][i]) print_indexable(c) print_indexable2(c) if isinstance(c, Indexable): print("yup") else: print("Nope") ```
TypeVars can't be passed to `isinstance` -- otherwise that should work (though a TypeVar that's not used in the return value is sorta meaningless -- pyright will complain, mypy will allow it)