anthonywritescode
anthonywritescode
  • 1 099
  • 3 275 881
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!
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

Komentáře

  • @replikvltyoutube3727

    Seems like the performance is not worth it compared to headache of configuring it in CICD 😅😅

  • @bernardodc9631
    @bernardodc9631 Před dnem

    What about PDM?

  • @SodalisUK
    @SodalisUK Před 2 dny

    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.

  • @saeidzafari6870
    @saeidzafari6870 Před 4 dny

    Hi , I wanna shred my picture in my phone but does have an error , permission denied , how can I solve that? Thanks

  • @Cohnan13
    @Cohnan13 Před 4 dny

    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

  • @urknidoj422
    @urknidoj422 Před 5 dny

    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.😆

  • @amir.hessam
    @amir.hessam Před 7 dny

    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 😬

  • @AlexGeorge
    @AlexGeorge Před 8 dny

    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.

  • @dmytroparfeniuk2670

    Oh, nice)

  • @user-jo4ij9fg1d
    @user-jo4ij9fg1d Před 9 dny

    \o/ ... That's cool!

  • @447xpro
    @447xpro Před 11 dny

    Thanks!

  • @ccos218
    @ccos218 Před 11 dny

    PDM is the way

  • @Xavi-s2i
    @Xavi-s2i Před 12 dny

    I thought it was true triple yoru

  • @maxmax-mn1vg
    @maxmax-mn1vg Před 13 dny

    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

  • @cool-jg2050
    @cool-jg2050 Před 13 dny

    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

  • @cool-jg2050
    @cool-jg2050 Před 13 dny

    So there is no way to use braces like in Java

  • @jareddunlop8411
    @jareddunlop8411 Před 13 dny

    Thanks, I was trying to learn this from a book and I needed to see it in action.

  • @jakubtybinski9246
    @jakubtybinski9246 Před 14 dny

    Pog

  • @oliversheridan-methven8906

    Something comparing submodules with subtrees would be nice.

  • @kmacdowe
    @kmacdowe Před 15 dny

    Thanks! What kind of keyboard/mouse set up is that? It looks useful.

  • @JorgeAnais
    @JorgeAnais Před 15 dny

    I typically watch videos at 2x speed, but this time I'm watching at 0.5x speed.

  • @slavapasedko3139
    @slavapasedko3139 Před 15 dny

    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.)

    • @anthonywritescode
      @anthonywritescode Před 15 dny

      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

  • @senseikoudai6186
    @senseikoudai6186 Před 16 dny

    Maybe an obvious question, but why were there two None values in the first place?

    • @slavapasedko3139
      @slavapasedko3139 Před 15 dny

      Generator can yield, return and accept value using .send() Hence three typings for each of those possibilities

    • @anthonywritescode
      @anthonywritescode Před 15 dny

      I cover this in the video linked in the description in more detail as well!

  • @bashirabdelwahed40
    @bashirabdelwahed40 Před 16 dny

    oh finally!!!!!!

  • @hansdietrich1496
    @hansdietrich1496 Před 16 dny

    Yeah, that always caused eye cancer.

  • @AceofSpades5757
    @AceofSpades5757 Před 16 dny

    That's fantastic. It's ugly and most people don't understand the other 2 anyhow

  • @madhan1926
    @madhan1926 Před 16 dny

    Is it possible to achieve git like functionality here? Like creating commit through one api, then using push api to push commits to github.

  • @sillybuttons925
    @sillybuttons925 Před 16 dny

    wow that is great. Always found that annoying.

  • @Quarky_
    @Quarky_ Před 16 dny

    Is there a difference between importing Generator from collections.abc and typing?

    • @iamcurrentlypooping
      @iamcurrentlypooping Před 16 dny

      typing.Generator is a deprecated alias to collections.abc.Generator

    • @Quarky_
      @Quarky_ Před 16 dny

      @@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

  • @ArcRCG
    @ArcRCG Před 17 dny

    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.

  • @bennyyouknow
    @bennyyouknow Před 17 dny

    Love your energy in this one 😊 Indeed a nice QoL improvement 🎉

  • @kRySt4LGaMeR
    @kRySt4LGaMeR Před 17 dny

    really cool, but it highlights how foreign type hints are to the core language

  • @bswck
    @bswck Před 17 dny

    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`.

  • @lukajeliciclux3074
    @lukajeliciclux3074 Před 17 dny

    YESSSS!!!!! Generator[int,None,None] is just WHY?!

  • @guscardvs
    @guscardvs Před 17 dny

    This could be true for Coroutine also

    • @anthonywritescode
      @anthonywritescode Před 17 dny

      indeed! though I'm not sure Coroutine got the same treatment :(

  • @danielmajer1648
    @danielmajer1648 Před 17 dny

    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

  • @ColtinC
    @ColtinC Před 17 dny

    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.

  • @DavidDellsperger
    @DavidDellsperger Před 17 dny

    alternative title: Nerd gets excited he doesn't have to type ", None" as often

  • @ayhanfuat
    @ayhanfuat Před 17 dny

    It was so fun to watch you get happy about this. 😀

  • @flamendless
    @flamendless Před 17 dny

    696.... It is nice

  • @s-h-f
    @s-h-f Před 17 dny

    Didn't understand much as I am still a beginner. But seems like they get rid of ugly (unnecessary) annotations. Thanks for demo.

    • @bswck
      @bswck Před 17 dny

      annotations are beautiful, not ugly.

  • @victordvickie
    @victordvickie Před 17 dny

    I never seen a grown man more happy than this, good addition btw lol

  • @abrahammurciano
    @abrahammurciano Před 17 dny

    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

    • @anthonywritescode
      @anthonywritescode Před 17 dny

      I have one! I forgot to link it in the description but it's there now!

  • @abrahammurciano
    @abrahammurciano Před 17 dny

    This is exactly why I've always annotated my generators as Iterator[T]. Finally I can use Generator!

  • @bacon4life
    @bacon4life Před 17 dny

    Cool, I have dozens of Generator[T, None, None] in my projects.

  • @IleniaQuintero
    @IleniaQuintero Před 19 dny

    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.

  • @doodle3115
    @doodle3115 Před 19 dny

    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?

    • @anthonywritescode
      @anthonywritescode Před 19 dny

      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

    • @doodle3115
      @doodle3115 Před 18 dny

      ​@@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.

  • @ccgarciab
    @ccgarciab Před 20 dny

    Not implemented seemed kinda normal to me. Isn't not implemented usually a bottom type in other type systems?

  • @RicchiMachado
    @RicchiMachado Před 20 dny

    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.

    • @anthonywritescode
      @anthonywritescode Před 20 dny

      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

  • @joaomcarlos
    @joaomcarlos Před 20 dny

    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") ```

    • @anthonywritescode
      @anthonywritescode Před 20 dny

      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)