Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Tejas Shetty
    @TejasAvinashShetty
    Hi
    MChrys
    @MChrys
    hello guy,
    I would discuss with you about a cool function decorator I'm building.
    I juste noticed your awesome library and I think it could be a good contribution
    my function is about maling a true direct inheritance

    class B():
    def init(self, b:str):
    self.b = b

    @className
    class Foo(B,metaclass=Meta):
    @InheriteArgs(Foo)
    def init(self,yolo, name ='empty', surname = None):
    self.name = name
    self.surname= surname

    .
    inheriteArgs(Foo) make args from inerited class set too the sub class init in this example
    MChrys
    @MChrys
    so Foo class init is like :
    def init (self, yolo, b, name='empty', surname= None):
    super(Foo, self).init(b)
    self.name = name
    self.surname= surname
    for create a new instance I have to do:
    inst = Foo('yo', 100, name ='mike', surname='bigmike')

    inst .b

    100

    inst.yolo

    'yo'

    MChrys
    @MChrys
    let me know if you think it could be an interesting contribution
    Alex Hall
    @alexmojaki
    Hi @MChrys , that sounds interesting but I don't think it's the kind of magic that the sorcery library is about, unless I'm missing something?
    You might be interested in this library: https://github.com/mkorpela/overrides