Python Does What?!?

Kind of like "hey guys, check it out you can just duct tape down the dead-man's switch on this power tool and use it one handed". In Python.

Saturday, October 19, 2024

Enums make good singletons

›
It's simple and common to allocate a marker object to represent missing or null data. MISSING = object() There's a slightly more...
Thursday, March 14, 2024

Wisdom for the ages

›
>>>type(type) is type True

sequence unpack a dict

›
>>> a, b = {"a": 1, "b": 2} >>> a 'a'
Monday, March 6, 2023

Annotation Inheritance

›
Let's talk about annotations . Type annotations in Python are mostly a static declaration to a type-checker like mypy or pyright ab...
Wednesday, September 14, 2022

Mock Everything

›
 A mock object is meant to simulate any API for the purposes of testing. The python standard library includes MagicMock . >>> fro...
Sunday, January 16, 2022

Are they equal?

›
>>> a = []; a.append(a); a [[...]] >>> b = []; b.append(b); b [[...]] >>> a == b Traceback (most recent call last...
6 comments:
Thursday, September 3, 2020

Not counting zeros

›
We all have our favorite way of intentionally raising an exception in Python. Some like referencing an undefined variable to get a simple Na...
20 comments:
›
Home
View web version

Contributors

  • Kurt Rose
  • Mahmoud Hashemi
Powered by Blogger.