Just in case the Pin object was getting immediately de-allocated and reset to some particular state (since I wasn’t retaining its value in this test), I modified the code to retain a reference to the returned object, but that didn’t make any difference in behavior.
from machine import Pin
import time
pins = (11,12,13,15,16,18,19,21,22,23,24,26,27,28,31,32,33,35,36,37,38,40)
b=[]
for p in pins:
print(p)
b.append(Pin(p, Pin.IN, Pin.PULL_UP))
print("READY")
while True:
time.sleep(0.25)
pass