Meta Class vs. Traditional Descriptor

0

I've been watching the videos ( example ) by Luciano Ramalho on descriptors with < in> metaclass .

I wanted to know what the advantage of this model is over the more traditional implementation of descriptors as this example in the documentation.

I did a test and it seemed to work for me. I also noticed that in the documentation example the getattr and setattr methods are not used as in example of Luciano.

    
asked by anonymous 12.05.2018 / 17:14

1 answer

0

Actually I was completely out of date with the new features of python3.6 +. Python3.6 introduced the protocol descriptor object.__set_name__(self, owner, name) called at the time the class is created. So I think it's no longer necessary to use metaclass to work with Descriptors from Python3.6 +. Here's the publication that I've read about it, it even makes comparisons between the new version and the legacy mode.

    
14.05.2018 / 22:16