A Few Neat Tricks For Customizing Dataclasses // Python Tips

preview_player
Показать описание


🎓 Courses:

👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!

👀 Code reviewers:
- Yoriz
- Ryan Laursen
- Sybren A. Stüvel
- Dale Hagglund

#arjancodes #softwaredesign #python

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!
Рекомендации по теме
Комментарии
Автор

Arjan, I'd love to see your take on descriptors, as it's hard to find good examples of using them for anything beyond simple type validations, although rumor has it they can be very powerful :) (at least as far as code neatness is concerned). Wouldn't they make for a perfect continuation of your "upper-intermediate" series after custom context managers, asyncio, functools, etc.?

marceli_pappenhaupt
Автор

Love your content, always going to the point with a good example.

jorgealarconalvarez
Автор

Do you prefer dataclass or pydantic basemodel? Which one is more powerful, or more user-friendly? I am trying to use one consistently since they seems got many overlapping features. Thanks.

qiangxue
Автор

I like these suggestions. But I have a question about how something like _search_string should work in a dataclass. Obviously if a person's name or city changes, _search_string should be updated. How would you recommend handling this?

kenhaley
Автор

I think at this point yo should do an attrs video. It is where Python dataclasses come from and offer so mich more functionality than the stdlib ones.

sasanjac
Автор

What is a field in python? Does it have other uses?

TVDaJa