Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
Show HN: Pattern matching and guards for Python functions
(opens in new tab)
(github.com)
6 points
rasguanabana
10y ago
4 comments
Save
Share
4 comments
4 comments · 1 top-level
top
newest
oldest
creshal
10y ago
· 3 in thread
Example suggestion: Ensuring that an argument is a list of strings. I can't be the only one who wasted hours of debugging because I accidentally fed a string to a function expecting a list of strings.
rasguanabana
OP
10y ago
Thank you for suggestion, I have added a simple example.
guan
10y ago
Can I use the generics introduced with the new type annotations in Python 3.5, so I can refer to Sequence[str] or something like that?
creshal
10y ago
The problem is that every string is, internally, also a sequence of (single-character) strings. So it's not
that
easy.
j
/
k
navigate · click thread line to collapse