Character encoding is one of those topics many software engineers would prefer to have a very minimal understanding of. It's perceived as tricky, uninteresting, and is pretty much an afterthought for most projects that aren't internationalized. This lack of attention leads to tricky bugs that find a way around traditional …
At the risk of this blog becoming dedicated to "the worst things you can do in Python" I present to you: multiline lambdas in Python!
Implementation was simple:
import sys
def fun(string):
frame = sys._getframe(1)
out = {}
locals = {}
locals.update(frame.f_globals)
locals.update(frame.f_locals)
exec ("def __anon …
One of the nicest features of functional programming languages like Haskell and Erlang is pattern matching. An example, from Learn You Some Erlang:
greet(male, Name) ->
io:format("Hello, Mr. ~s!", [Name]);
greet(female, Name) ->
io:format("Hello, Mrs. ~s!", [Name]);
greet(_, Name) ->
io:format("Hello, ~s!", [Name]).
The …