tessl install tessl/pypi-wtfpython@3.0.0Educational collection of surprising Python code snippets that demonstrate counter-intuitive behaviors and language internals
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.06x
Baseline
Agent success rate without this tile
88%
A utility that helps developers understand Python's string identity behavior and the difference between identity (is) and equality (==) checks.
Implement a function that determines whether a string will be interned by CPython based on its characteristics.
Implement a function that compares two strings using both identity (is) and equality (==) operators and returns the results.
@generates
def will_be_interned(string_value: str) -> bool:
"""
Determines if a string will be interned by CPython based on its characteristics.
Args:
string_value: The string to check
Returns:
True if the string will be interned, False otherwise
"""
pass
def compare_strings(str1: str, str2: str) -> dict:
"""
Compares two strings using both identity (is) and equality (==) operators.
Args:
str1: First string to compare
str2: Second string to compare
Returns:
A dictionary with keys 'equal' (bool) and 'identical' (bool)
"""
passEducational resource explaining Python's string interning and identity behavior.
@satisfied-by