#functools

Python Ireland - old accountpythonie
2024-06-13

Mia Bajić: The Standard Library Tour @ PyCon Ireland 2023

youtu.be/ZId-JEMSCQ8

The Standard Library Tour is designed to provide attendees with an understanding of Python's standard library less known features. Have you ever found yourself writing complex code only to discover that Python has tools available within its library that could have made your job easier? Then this talk is for you!

2024-02-01

@driscollis yet another thing in the #python standard library I've never seen or used. I wonder when one would use the functools.singledispatch over a set of if isinstance(..) elif isinstance(..)? The singledispatch feels like a bit of magic since going to the definition of the function does not show what it does and one has to go to Ctrl-F for all the @func.register's to find the implementation 🤔

#functools #pythonstandardlibrary

Nicolas Fränkel 🇺🇦🇬🇪frankel@mastodon.top
2023-09-08

#Python’s #functools Module: Caching, Dispatching, and Other Higher-Order Operations. Explaining Python’s functools module, including caching, comparison utilities, function dispatching, and more.

thecodecadence.medium.com/pyth

Jesper Dr.amsch :v_enby:jesper@tech.lgbt
2023-08-29

Today I learnt about @cached_property in python

As a classically trained physicist, my natural style of programming is functional.

But in production-level code, we usually want a mix of classes and functions.

However, this can get awkward.

THE CHICKEN AND EGG ATTRIBUTE DILEMMA
Oftentimes, we'll calculate some properties for a class and set them as attributes. Maybe it's the mean and standard deviation for our data class in machine learning, for example.

But that'd mean we have to initialise our class, load the data at initialisation and calculate those statistics.

That can be a bit silly in many cases.

Especially when we're building a larger class with some extra utility, this can quickly devolve into creating a monster at __init__.

Read more… [dramsch.net/today-i-learned/da] (2 min remaining to read)

#Functools #Python #TodayILearned #MachineLearning

Find more here: dramsch.net/today-i-learned/da

Jesper Dr.amsch :v_enby:jesper@tech.lgbt
2023-08-26
GripNewsGripNews
2023-06-09

🌗 函數式編程 HOWTO — Python 3.11.4 文件
➤ Python 的函數式編程特性
docs.python.org/3/howto/functi
本文介紹 Python 的函數式編程特性,包括迭代器、生成器、itertools 和 functools 等庫模塊。函數式編程將問題分解為一組函數,並鼓勵使用純函數,即只接受輸入並生成輸出,不修改內部狀態。函數式編程具有形式化可證明、模塊化、可組合、易於調試和測試等優點。
+ 很好的介紹了 Python 的函數式編程特性,讓我更好地理解了函數式編程的概念和優點。
+ 這篇文章很有用,尤其是對於那些想學習函數式編程的 Python 開發人員來說。

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst