Skip to content

Instantly share code, notes, and snippets.

@markus-mnm
markus-mnm / ExceptionToCheckconditions
Created June 9, 2017 02:16
Example of two different implementations to check some condition before running some code
package com.toursgds.transport.protocol;
import org.apache.commons.lang3.time.StopWatch;
public class TestException {
private static class ObfuscationNotSetUpException extends RuntimeException {}
boolean configured = false;
import yaml, os, sys, datetime
# slightly adapted from http://stackoverflow.com/a/44512
def merge(d1, d2, merge_fn=lambda x,y:y):
result = dict(d1)
for k,v in d2.iteritems():
if k in result:
if isinstance(result[k], dict):
print "going in for " + k