Python Match Pattern Matching

Descripción

Match-case with pattern matching by type


File Template: ❌


Prefix

match:pattern


Scopes

python


Snippet de código

match ${1:obj}:
	case str(${2:s}):
		return len(${2:s})
	case int(${3:i}):
		return ${3:i}
	case None:
		return ${4:0}
	case _:
		return ${5:-1}