Colors of Ray+Hue'

python +2

study 1 day

python2016. 5. 10. 09:52

interactive.blockdiag.com


그래프 그리기


http://graphviz.org/



'python' 카테고리의 다른 글

기본 문법  (2) 2015.11.20

기본 문법

python2015. 11. 20. 10:56

***********************************************************************

@: decorator

- 원본 클래스가 있을때, 클래스에 추가 함수를 붙임. 원본 클래스에 손상 없이 추가 함수만을 이용하여 추가 기능을 사용할 수 있음.

*** example ***

class Verbose:

def __init__(self, f):

print "Initializing Verbose."

self.func = f;


def __call__(self):

print "Begin", self.func.__name__

self.func();

print "End", self.func.__name__


@Verbose

def my_function():

print "hello, world."


print "Program start"

my_function();

*** result ***

$ python decorator_test.py

Initializing Verbose

Program start

Begin my_func

hello, world

End my_func

***********************************************************************

yield 

static과 동일함. 

***********************************************************************

딕셔너리 : {key1:value1, key2:value2}

리스트   : [value1, value2]

튜플     :  constant list -- (value1, value2),  (value1,) -- 한개 있는 것은 콤마를 찍어줘야 함

'python' 카테고리의 다른 글

study 1 day  (0) 2016.05.10