Mar-19-2020, 06:51 PM
(This post was last modified: Mar-19-2020, 06:51 PM by wolfmansbrother.)
I am am stuck, i want to define a class with __init__ hsing the type format
how could i get a similar result in a second example
Complete question: How do i define class functions using type(cls,(),{})?
Class A:
phish = 'Band'
a = A()
# above is the same as
a = type(A,(),{'phish':'Band'}But, what is the equivalent type() syntax for:Class A:
def __init__(self)
self.phish='Band'
a = A()
a = type(A,(),{'__init__':*something here*}when i print attr.items() i get something like '__init__', <function A.__init__ at 0x0000015D216FB9D8> in the first examplehow could i get a similar result in a second example
Complete question: How do i define class functions using type(cls,(),{})?
