Skip to content

Instantly share code, notes, and snippets.

View puzzlet's full-sized avatar

정 경훈 (Kyung-hown Chung) puzzlet

View GitHub Profile
>>> u'python 패스의 문제였다. 이제 완전 해결'
u'python \u1111\u1162\u1109\u1173\u110b\u1174 \u1106\u116e\u11ab\u110c\u1166\u110b\u1167\u11bb\u1103\u1161. \u110b\u1175\u110c\u1166 \u110b\u116a\u11ab\u110c\u1165\u11ab \u1112\u1162\u1100\u1167\u11af'
>>> x = _
>>> import unicodedata
>>> unicodedata.normalize('NFC', x)
u'python \ud328\uc2a4\uc758 \ubb38\uc81c\uc600\ub2e4. \uc774\uc81c \uc644\uc804 \ud574\uacb0'
>>> print _
python 패스의 문제였다. 이제 완전 해결
@puzzlet
puzzlet / id_anomaly.py
Created October 22, 2012 05:41
never use id() with unbound function
$ python2.7 id_anomaly.py
old_func is not new_func
('old_func:', 41458576, <bound method classobj.member_func of <class __main__.A at 0x278bf58>>)
('new_func:', 41314096, <bound method classobj.member_func of <class __main__.A at 0x278bf58>>)
$ python3.2 id_anomaly.py
old_func is not new_func
old_func: 140100968595896 <bound method type.member_func of <class '__main__.A'>>
new_func: 140100968596184 <bound method type.member_func of <class '__main__.A'>>
@puzzlet
puzzlet / gist:3998342
Created November 2, 2012 02:36
The wild world of ZeroDivisionError messages
# Python 2.5 & 2.6
1/0 # ZeroDivisionError: integer division or modulo by zero
1%0 # ZeroDivisionError: integer division or modulo by zero
1.0/0 # ZeroDivisionError: float division
1.0%0 # ZeroDivisionError: float modulo
# Python 2.7
1/0 # ZeroDivisionError: integer division or modulo by zero
1%0 # ZeroDivisionError: integer division or modulo by zero
1.0/0 # ZeroDivisionError: float division by zero
1.0%0 # ZeroDivisionError: float modulo
@puzzlet
puzzlet / gist:4109049
Created November 19, 2012 04:58
어서 와
var super_star = function() { // 어서 와
function super_star() { // 들어와
// 처음이지?
};
var property;
super_star.property = function (value) { // 어서 와
if (value !== undefined) { // 들어와
property = value;