#isinstance
i really don't understand python programmers sometimes
October 17, 2025 at 1:31 AM
Noticing a trend of Python programmers using “isinstance” as a guard for type checkers to verify the existence of a method or attribute.

Isinstance is VERY slow for negative cases, esp classes with a few layers of inheritance, or mixins.
February 9, 2025 at 1:04 AM
Is a #Python value of a particular type? It's tempting to say:

if type(s) == str:
print('Yes, a string!')

Far better to say:

if isinstance(s, str):
print('Yes, a string!')

Why?
- Works with subclasses
- Second argument can be a tuple of possibilities
June 6, 2026 at 3:30 PM
What Does `isinstance()` Do in Python? #python
What Does `isinstance()` Do in Python? #python
Learn what isinstance() does in Python and how to use this built-in function to check an object's type. Discover its practical uses along with key limitations.
realpython.com
August 10, 2025 at 3:00 AM
every time you do an isinstance check, barbara liskov cries
June 7, 2026 at 12:11 AM
Dica Python: Verificando tipos com isinstance()
#Python #programadores #bolhatech #linguagemPython #dicapython #isinstance #tipos
May 7, 2025 at 9:12 PM
아
RP를 하나하나 체크하지 않으려고 isinstance(record, models.AppBskyFeedPost.Record)일 때에만 라벨링을 하고 있었는데
초무님의 비밀글을 쓰면 app.bsky.richtext.facet#encrypt 렉시콘이 들어가는 부분이 타입 체크에 걸리는 건지 파이썬 atproto SDK에서 JSON을 클래스 객체로 변환하지 못하는 거였음
그늘셀프는 왜 항상 동작을 안 하고 있는가...
February 10, 2025 at 7:37 AM
Set one #Python class to inherit from another by putting the parent in ():

class Parent:
pass

class Child(Parent):
pass

Child.__bases__ # who does Child inherit from?

c = Child()
isinstance(c, Child) # True
isinstance(c, Parent) # also True!
May 17, 2026 at 3:38 PM
>>> isinstance(False, int)
True

lmao
July 26, 2025 at 9:37 PM
# In het taalkundenerdenhoekje

merge = lambda a, b: (a, b)
pf = lambda x: x if isinstance(x, str) else pf(x[0]) + pf(x[1])
print(pf(merge("Hello", merge(", ", merge("world", "!")))))
May 30, 2026 at 6:43 PM
“That allows for the practice of goose typing, meaning practicing duck typing with the built-in isinstance function.”

Read more 👉 pym.dev/goose-typing/

#Python
Goose typing
In Python you can practice type checking while also practicing duck typing!
pym.dev
September 13, 2026 at 10:47 PM
Python Tip #242 (of 365):

Prefer isinstance over type for type checking. 🧵

Do this:
isinstance(value, int)

Not this:
type(value) == int

Unlike comparing with type(...), using isinstance respects inheritance.

#Python #DailyPythonTip
August 30, 2026 at 6:04 PM
here’s an example of o3 where it hacked a comparison operator to pass a test
October 26, 2025 at 11:51 AM
Python Tip #219 (of 365):

Validate your ducks with goose typing 🧵

You can use isinstance() WHILE duck typing. This is sometimes called goose typing (coined by Alex Martelli).

>>> from collections‍.abc import Iterable
>>> isinstance([1, 2, 3], Iterable)
True

#Python #DailyPythonTip
August 8, 2026 at 2:18 AM
python's "there is no character type, only string" decision is ostensibly meant to help beginners out, and python beginners are told "do try:... except:" and to avoid checking types up front

but strings as lists breaks all that, so you have to go "isinstance" to prevent errors
June 15, 2025 at 5:48 PM
Python、
isinstance(True, int)
がTrueを返しちゃうのか...。
December 3, 2025 at 6:03 AM
“It's actually possible to use isinstance and practice duck typing at the same time!”

Read more 👉 pym.dev/goose-typing/

#Python
Goose typing
In Python you can practice type checking while also practicing duck typing!
pym.dev
August 13, 2026 at 5:21 PM
Want to build your own code quality tools? 🔍

Python’s `ast` module lets you analyze code like linters do! 💪

Below code snippet extracts all function & method names from a file.

What would you automate? 💡

#Python #AST #CodeQuality
March 3, 2025 at 10:30 AM
🐍📰 Learn what isinstance() does in Python and how to use this built-in function to check an object's type. Discover its practical uses along with key limitations

#python
What Does isinstance() Do in Python?
Learn what isinstance() does in Python and how to use this built-in function to check an object's type. Discover its practical uses along with key limitations:
realpython.com
October 26, 2025 at 5:30 PM
Dica da linguagem Python: Função isinstance()
#Python #programadores #bolhatech #dicas #linguagemPython #dicapython #py
October 10, 2024 at 11:22 PM
isInstance(variable, numbers.Number)

Or

type(variable) == int or float
July 18, 2023 at 1:31 PM
🐍 Python Term of the Day: isinstance() (Python’s Built-in Functions)

Returns True if the input object is an instance of a given class, and False otherwise.
isinstance() | Python’s Built-in Functions – Real Python
Returns True if the input object is an instance of a given class, and False otherwise.
buff.ly
March 22, 2025 at 2:41 PM
ABC stands for "abstract base class".

Inheriting from an ABC gets you two things:

1. isinstance and issubclass checks will work nicely (i.e. isinstance(x, Sequence))

2. Python will complain LOUDLY if you forgot to implement a required method, instead of failing later in some subtle way
August 9, 2026 at 12:34 AM
Today's computation is how to do some kind of thing with a data structure
I am not sure what as I just woke up but the colors look pretty and the code looks like it would do something serious
July 2, 2026 at 7:12 AM