Skip to content

Instantly share code, notes, and snippets.

View falsetru's full-sized avatar

이정민(Jeong-Min Lee) / SWAT falsetru

View GitHub Profile
@falsetru
falsetru / datameta.py
Last active December 7, 2018 14:28 — forked from tempKDW/datameta.py
Use `new_attrs` when creating __slots__
class DataMeta(type):
def __new__(cls, name, bases, attrs):
def check_type(k, v):
cls._validate(attrs[k]['type'], v)
def set_default(self, kwargs):
for key_meta, value_meta in attrs.items():
if key_meta.startswith('__') and key_meta.endswith('__'):
continue
if not isinstance(value_meta, dict):
@falsetru
falsetru / ex.py
Last active December 23, 2015 03:59 — forked from Hardtack/ex.py
functions = []
for val in ['foo', 'bar', 'baz']:
def f(val=val):
return val
functions.append(f)
for func in functions:
print(func())