비정적 타입의 키워드 인수

def log(message, when=datetime.now()):
    print("%s: %s" % (when, message))

log("Hi there!")
sleep(0.1)
log("Hi again!")

>>>
2014-11-15 21:10:10.371432: Hi there!       # 타임스탬프 동일하게 출력
2014-11-15 21:10:10.371432: Hi again!
def log(message, when=None):
    """ Log a message with a timestamp.
    
    Args:
        message: Message to print.
        when: datetime of when the message occurred.
            Defaults to the present time.
    """
    when = datetime.now() if when is None else when
    print("%s: %s" % (when, message))

log("Hi there!")
sleep(0.1)
log("Hi again!")

>>>
2014-11-15 21:10:10.4772303: Hi there!      # 타임스탬프 다르게 출력
2014-11-15 21:10:10.5773395: Hi again!