python


class Utc(tzinfo):
    "provide a tz concrete class"
    def __init__(self, offset = 0):
        self._offset = offset
    def utcoffset(self, dt):
        return timedelta(hours=self._offset)
    def tzname(self, dt):
        return "UTC +%s" % self._offset
    def dst(self, dt):
        return timedelta(hours=self._offset)html

 

def curry(x, argc=None): if argc is None: argc = x.func_code.co_argcount def p(*a): if len(a) == argc: return x(*a) def q(*b): return x(*(a + b)) return curry(q, argc - len(a)) return p
 @curry def myfun(a,b,c): print '%d-%d-%d' % (a,b,c) myfun(11,22,33) myfun(44,55)(66) myfun(77)(88)(99)
http://www.cnblogs.com/goodspeed/archive/2011/11/07/python_tzinfo.htmlhttps://mtomassoli.wordpress.com/2012/03/18/currying-in-python/
相關文章
相關標籤/搜索