Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
class BTreeNode(object): | |
"""A B-Tree Node. | |
attributes | |
===================== | |
leaf : boolean, determines whether this node is a leaf. | |
keys : list, a list of keys internal to this node | |
c : list, a list of children of this node | |
""" | |
def __init__(self, leaf=False): |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.
class Node: | |
def __init__(self, val): | |
self.val = val | |
self.leftChild = None | |
self.rightChild = None | |
def get(self): | |
return self.val | |
def set(self, val): |
__author__ = 'artemr' | |
''' | |
왜 파이썬 데코레이터를 만들때, @wraps어노테이션을 쓰는 것을 권장하는 걸까? | |
이유인 즉슨, 데코레이터 내부에서 인자로 전달받은 함수가 익명함수 처럼 취급되어 버리므로 디버깅이 난해해지는 단점이 있었기 때문이다. | |
자세한 설명은 아래의 링크에 첨부되어 있다. | |
원본: http://artemrudenko.wordpress.com/2013/04/15/python-why-you-need-to-use-wraps-with-decorators/ | |
사본: https://www.evernote.com/shard/s174/sh/78eaad5f-a8f2-4496-b984-e3385fb963c0/922d9ab4b5cd23ac7b85aab42536aa4f | |
''' | |
Below are many examples of function hoisting behavior in JavaScript. Ones marked as works
successfuly print 'hi!' without errors.
To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js
(I may be using incorrect terms below, please forgive me)
영어지만, 조금 더 상세하게 마크다운 사용법을 안내하고 있는
"Markdown Guide (https://www.markdownguide.org/)" 를 보시는 것을 추천합니다. ^^
아, 그리고 마크다운만으로 표현이 부족하다고 느끼신다면, HTML 태그를 활용하시는 것도 좋습니다.
GitHub Gist는 GitHub과는 달리, private도 무료입니다. 저는 주로 코드조각(Code Snippet), 로그, 메모 등을 남기는데 사용합니다.