![]() |
![]() |
![]() |
Ed Rogers |
David Hoese |
Josh Karpel |
MadPy is a community group and open to all experience levels. We are committed to a safe, professional environment
We are enthusiastically focused on improving our event and making it a place that is welcoming to all. All reports will be taken seriously, handled respectfully, and dealt with in a timely manner.
Learn more about the MadPy Code of Conduct:
https://github.com/madison-python/code-of-conduct
madpy_menu = {
"pizza": "Ian's",
"beverage": "Sprite",
}def get_menu_item(key, default=None):
value = madpy_menu.get(key)
if value is None:
return default
return valueget_menu_item("pizza")"Ian's"
get_menu_item("salad", default="Sorry, not tonight!")'Sorry, not tonight!'
madpy_menu = {
"pizza": "Ian's",
"beverage": "Sprite",
"dessert": None,
}def get_menu_item(key, default=None):
value = madpy_menu.get(key)
if value is None:
return default
return valueget_menu_item("salad", default="Sorry, not tonight!")'Sorry, not tonight!'
get_menu_item("dessert", default="Sorry, not tonight!")'Sorry, not tonight!'
Can't distinguish between not being on the menu, and being on the menu and None-valued!
madpy_menu = {
"pizza": "Ian's",
"beverage": "Sprite",
"dessert": None,
}MISSING = object()
def get_menu_item(key, default=None):
value = madpy_menu.get(key, MISSING)
if value is MISSING:
return default
return valueget_menu_item("salad", default="Sorry, not tonight!")'Sorry, not tonight!'
get_menu_item("dessert", default="Sorry, not tonight!") is NoneTrue
print(MISSING)<object object at 0x7bf5c437d710>
madpy_menu = {
"pizza": "Ian's",
"beverage": "Sprite",
"dessert": None,
}from enum import StrEnum
class Missing(StrEnum):
MISSING = "MISSING"
def get_menu_item(key, default=None):
value = madpy_menu.get(key, Missing.MISSING)
if value is Missing.MISSING:
return default
return valueget_menu_item("salad", default="Sorry, not tonight!")'Sorry, not tonight!'
get_menu_item("dessert", default="Sorry, not tonight!") is NoneTrue
print(Missing.MISSING)MISSING
from sys import version
print(version)3.15.0b2 (main, Jun 2 2026, 22:26:04) [Clang 22.1.3 ]
from builtins import sentinel
MISSING = sentinel("MISSING")madpy_menu = {
"pizza": "Ian's",
"beverage": "Sprite",
"dessert": None,
}MISSING = sentinel("MISSING")
def get_menu_item(key, default=None):
value = madpy_menu.get(key, MISSING)
if value is MISSING:
return default
return valueget_menu_item("salad", default="Sorry, not tonight!")'Sorry, not tonight!'
get_menu_item("dessert", default="Sorry, not tonight!") is NoneTrue
print(MISSING)MISSING
![]() | madpy.com |
![]() | meetup.com/madpython |
![]() | github.com/madison-python |
![]() | fosstodon.org/@madpy |
![]() | slack.madpy.com |
![]() | linkedin.com/company/madpy |









