python warnings got way better in 3.12!

  Рет қаралды 4,096

anthonywritescode

anthonywritescode

Күн бұрын

I totally missed this improvement when reviewing 3.12 back in the day and it's pretty significant. but I think they missed one key part :(
warnings in python: • python warnings (begin...
python warnings defaults suck: • python warnings defaul...
what's new in python 3.12: • python 3.12 release hi...
playlist: • anthony explains
==========
twitch: / anthonywritescode
dicsord: / discord
twitter: / codewithanthony
github: github.com/aso...
stream github: github.com/ant...
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!

Пікірлер: 13
@eliottwillis784
@eliottwillis784 3 ай бұрын
Nice! I wonder why `skip_file_prefixes` parameter has not been added to the new `warnings.deprecated` decorator in Python 3.13.
@SQADIqw
@SQADIqw 3 ай бұрын
Does it have the same issue pointing on library code instead of library user calls?
@anthonywritescode
@anthonywritescode 3 ай бұрын
weird that they didn't add the api there too -- even more confusing they have `stacklevel=1` as the default... but it acts as `stacklevel=2` (so at least they got that part right?)
@spencer3752
@spencer3752 2 ай бұрын
Oh man. For internal calls to user-facing APIs that may invoke a warning, I've been doing things like `warnings.catch_warnings` and re-emitting warnings to correct the stack level. This seems a lot more convenient.
@mrswats
@mrswats 3 ай бұрын
Never skip profecies
@aditya_marathe
@aditya_marathe 3 ай бұрын
Finally installed 3.12 looking forward to daily driving it for the foreseeable future.
@ruroruro
@ruroruro 3 ай бұрын
Btw, I wonder, how would one use this feature if your python package provides both the libary code and an executable entrypoint (via __main__.py or via console_scripts or similar).
@anthonywritescode
@anthonywritescode 3 ай бұрын
imo the warning system doesn't really make sense for cli tools -- it's more for programmatic warnings
@CooperE16
@CooperE16 3 ай бұрын
You mentioned you mainly write tools as opposed to libraries. What’s the distinction? I understand libraries v applications? Are tools just applications for developers? eg CLI
@AcuteAangle
@AcuteAangle 3 ай бұрын
I usually understand a ‘tool’ to be a program with a single primary purpose. I would describe the Coreutils as ‘tools’, as well as single-purpose GUI utilities like balenaEtcher. The CLI programs provided by ImageMagick, `ffmpeg`, or `btrfs-progs` as well. I wouldn’t call Firefox, Emacs, or KDE tools, however, as they have an expansive scope, being more like long-lived workspaces you perform a variety of tasks in, rather than narrowly-scoped utilities for a specific class of uses. Daemons and games are also not usually called ‘tools’.
@anthonywritescode
@anthonywritescode 3 ай бұрын
for me libraries are imported and used by other software. tools are kinda everything else (self contained, don't provide programmatic apis) and for me they are almost all in the form of command line applications
@ln11389
@ln11389 3 ай бұрын
I have been working with 3.12 for a while and this was very informative. Thanks for the video.
supercharging coverage with sys.monitoring (PEP 669)
14:16
anthonywritescode
Рет қаралды 4,2 М.
python is too slow...
17:45
anthonywritescode
Рет қаралды 4,3 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
python 3.13 release highlights
49:56
anthonywritescode
Рет қаралды 22 М.
Why You Should Think Twice Before Using Returns in Python
21:27
ArjanCodes
Рет қаралды 56 М.
py-spy saved our python 3.11 rollout (intermediate) anthony explains #568
13:48
Stop using std::vector wrong
23:14
The Cherno
Рет қаралды 172 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 905 М.
5 Python Libraries You Should Know in 2025!
22:30
Keith Galli
Рет қаралды 91 М.
debugging a broken cache!
21:16
anthonywritescode
Рет қаралды 5 М.
Python itertools - The key to mastering iteration
20:03
mCoding
Рет қаралды 37 М.
debugging and fixing pyuwsgi in python 3.12 (advanced) anthony explains #580
1:00:01
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН