def generic_func(*args, **kwargs):
print('the positional args are:', args)
print('the keyword args are:', kwargs)
generic_func()
generic_func("one", "two", "three", blah=1, moshe=2, test=[1,2,3])
len([1,2,3], [1,2,3])
print(1,2,3,4,5,6,7,8,1,2,34,25,4,5432,5432,5432,5432,5432)
def test():
class ToldYou:
pass
import math
x = 10
def inner():
print('in inner func')
return inner
def make_str_factory(s):
def str_factory():
return s
return str_factory
smiley_factory = make_str_factory('😊')
hello_factory = make_str_factory('hello')
smiley_factory.__closure__
dir(smiley_factory)
hello_factory()
class Factory:
def __init__(self, value):
self.value = value
def make(self):
return self.value
smiley_factory = Factory('😊')
smiley_factory.make()