Joined June 2012
·

Caio Ariede

I build things ZZ
·
Bauru, São Paulo, Brazil
·
·
·

Posted to Wishing you a multilingual Christmas over 1 year ago

Erlang:

-module(xmas).
-export([main/0]).

main() ->
    Xmas = "beer ",
    NewYear = "more beer",

    case Xmas ++ NewYear of
        "beer more beer" ->
            io:fwrite("festive hangover~n");
        _ ->
            ok
    end.

Erlang (recursive approach):

-module(xmas).
-export([main/0]).

drink(Beer="beer") ->
    drink([Beer|"more beer"]);

drink(["beer"|"more beer"]) ->
    io:fwrite("festive hangover~n").

main() ->
    drink("beer").
Posted to python breakpoint one-liner over 1 year ago

Good protip.

Rpdb (pdb for remote) and it's inline version is very useful too.

http://coderwall.com/p/ttbtgq

It's the reverse case. Keep the window but close the buffer.

This is not a design flaw, it's a feature.

For this kind of situation you might consider this:

def foo(arr=None):
    if arr is None:
        arr = []
    arr.append('x')
    print(arr)

A little more verbose but still very readable :)

Achievements
607 Karma
60,873 Total ProTip Views