This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def log(func): | |
@wraps(func) | |
def wrapper(*args,**kwargs): | |
if args: | |
print 'args is: %s, decorated func is: %s, doc: %s ' % (args, func.__name__,func.__doc__) | |
elif kwargs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lonely(object): | |
instance = None | |
def __new__(cls, *args, **kwargs): | |
if cls.instance is None: | |
cls.instance=object.__new__(cls) | |
return cls.instance | |
def __init__(self, name, lastname): | |
self.name=name |
NewerOlder