I've recently started learning Python (again), and this time it seems to be sticking. The only problems I'm left with are the small, stupid ones that you only get if you've been writing Perl code for years:
re.match() != re.search()You'd expect re.match() and re.search() to be identical, but they're
not: re.match() only matches at the beginning of the string.
If you want "Perl-like" matching, use re.search(),
which will match even if the pattern doesn't start at the beginning of the
string.
break/continue vs last/nextI don't know why it took me ages to find this, but the Python
equivalents of Perl's last/next statements are
break and continue. And I keep remembering it the
wrong way around, too.
I'll keep updating this post with other "small things" I find as I'm getting to know Python better.
Op dit werk is een Creative Commons Licentie van toepassing.