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
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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-bw5AHdZA7e4.html - don't lru_cache a method: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sVjtp6tGo0g.html - fixing a 9GB memory leak in cargo: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-uxJhAXdBlbc.html
@@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.
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`.
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! RU-vid has not put them in my feed for awhile.
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
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.
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)
i think it is very weird, that -O sets __debug__ to false, which i would assume would be the normal behaviour. So you dont habe to enable debug, but disable it
I don't know how he does it but Anthony always manages to leave me speachless. Here I am thinking that I know Python quite well yet he always finds something to demo that makes me go O_o
That's annoying. Is there a way to circumvent that somehow? I guess you could have tests that catch that but testing types in tests is not my favorite thing...
to support other class instances as a right part of comparison/arithmetic operation that you don't know how to work with but they may know how ```python >>> 1 + MyNumberClass() ``` without `int` returning `NotImplemented` for `__add__` it won't be possible to use an overload in `MyNumberClass.__radd__` since `NotImplementedError` will be raised (and they can be raised by anything down the road while every function directly controls what it `return`s)
I explained the reason for that at the end! (note that in addition to the reasons I state in the video it's not raising also, it's returning -- exceptions aren't part of the type system)
I know it's an old video, but I just came across this situation where C() > D() And C doesn't know about D but D did know about C, Is there a way to type hinted it in a way that mypy will know it is valid C() < D() but not C() < SomeOtherClass()?
not really, due to the way python is there aren't good mechanisms statically to know when things are comparable (besides well known ones like None which get special cased in the type system)