Results for “type checking”
Small, practical examples. Search by task or narrow things down below.
Remove duplicate values with a Set
Keep the first occurrence order while deduplicating.
Set✓ Tested
Represent a record with a dataclass
Python: Generate initialization and convert a typed record to a dictionary.
Python✓ Tested
Return the first item with a generic function
Preserve the element type while allowing empty arrays.
generics✓ Tested
Safely read a caught error
Check the error type before accessing its message.
unknown✓ Tested
Show the first lines of a file
Read only the first three lines of a text file, useful for checking a header or previewing a large log.
head✓ Tested
Store and retrieve a multibyte integer
Arduino / C: put and get copy the bytes of a typed value.
Arduino / C✓ Tested
Substitute a value for NULL
Use SQL Server’s ISNULL expression.
ISNULL✓ Tested
Update an object with a readonly input
Create a changed copy while retaining the original.
readonly✓ Tested
Write a text file
Write and close a C++ output file while checking stream failure.
C++✓ Tested
Write a text file
Open, write, and close a C file while checking every operation.
C✓ Tested