Skip to content

Instantly share code, notes, and snippets.

@Oleh-Hrebchuk
Oleh-Hrebchuk / task1.py
Created March 18, 2016 15:03
decorators
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:
@Oleh-Hrebchuk
Oleh-Hrebchuk / task1.py
Last active March 15, 2016 16:39
oop hulpa
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