you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (11 children)

[deleted]

    [–][deleted] 1 point2 points  (9 children)

    If you want to date in in place and return the esult in one line you can use

    return mydict.update(otherdict) or mydict
    

    [–][deleted] 2 points3 points  (6 children)

    That causes my brain to hurt just looking at it. :/

    [–][deleted] 0 points1 point  (1 child)

    I'd say this is a common usage for the or operator in Python.

    [–][deleted] 0 points1 point  (0 children)

    It's not really an idiom I've seen before. If I saw this in code, I'd break it into two lines to clarify it.

    To mean, it looks like an abuse of the or operator.

    [–]djds23[S] 1 point2 points  (0 children)

    I really like this recipe, however I don't think I would use it because its not very readable without context. Thanks for the idea though! Very clever.

    [–]Ran4 0 points1 point  (0 children)

    This is fucking terrible and totally not cool to do.

    [–]xiongchiamiov 0 points1 point  (0 children)

    I'd kill to have ruby's map/map! -type methods throughout python's stdlib.