This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
functions = [] | |
for val in ['foo', 'bar', 'baz']: | |
def f(val=val): | |
return val | |
functions.append(f) | |
for func in functions: | |
print(func()) |