#DuckTyping

2025-03-06
2025-02-23

To be precise, 3 bad rows out of 600M...

#ducktyping - talk to your kids about it before someone else does.

Trey Hunner 🐍treyhunner
2024-11-28

What's in a name? That which we call a duck
By any other name would quack the same;
So a sequence would, were it not a sequence call'd,
Retain that dear iterability which it bears
Without that title. Sequence, doff thy name,
And for that name which is no part of thee
give thy iterator to me.

2024-08-31

Checking for an empty list in Python - Python Morsels (@treyhunner)

Various methods to check if a list is empty in Python:
➡️ checking the list's length,
➡️ evaluating the list's truthiness
➡️ comparing the list to another empty list

#Python #Truthiness #PEP8 #DuckTyping #Programming #PythonProgramming

pythonmorsels.com/checking-for

💾 Paweł Łukasikpawel_lukasik@infosec.exchange
2024-03-25

Another duck-typing 🦆 post. A few days ago, I covered the GetAwaiter method that allows adding await functionality to any type. Today, another feature that relies on the same construct.

Deconstruction is a feature that allows extracting separate values out of a tuple. But what if we would like to deconstruct a type that is a bit more complex than a tuple? We can do it with the help of duck typing.

Deconstruction will work if the compiler detects a Deconstruct method that matches the call that we are trying to make. For example, let's try to deconstruct a Process. See the example below.

We start the process and wait for it to exit. In 1️⃣, we would like to use deconstruction to assign Pid & ExitCode to two variables. It won't work out of the box. But we can write an extension method 2️⃣ that the compiler would be able to use to perform the deconstruction.

Docs 📑: learn.microsoft.com/en-us/dotn

#dotnet #ducktyping #deconstruct

C# code with Deconstruct extension method
Things Drawn By Text ModelsThingsDrawnByTextModels@hachyderm.io
2023-02-26

Turns out duck typing is actually a way you can draw ducks with code: #DuckTyping #BingAI #Bing

Bing Prompt: "Write a javascript function that draws a duck"

Bing Response:
"
./ Searching for: javascript function draw duck ./ Searching for: javascript code draw duck ./ Generating answers for you...

Sure, | can help you with that. There are different ways to write a javascript function that draws a duck.

One way is to use the HTMLS5 canvas element and its drawing methods ' 2 . Another way is to use an

image of a duck and manipulate its position and size using javascript * . A third way is to use duck

typing, which is a concept that allows you to use any object that has a draw method as if it were a duck

4 5 6 7 Which way do you prefer?"
scy 🔜 WHYscy@chaos.social
2022-11-29

@chaotin “Well if it smells like lemon cake and tastes a bit sour… 🤷‍♂️”

#ducktyping

2020-10-19

#DuckTyping : when you can't formalize a relationship between T and F

2019-03-19

@TeethTeethTeeth if it walks like a duck. And talks like a duck. And looks like a duck.

.
..
...
..
.

It must be an #echidna

#ducktyping

Client Info

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