When and why might I assign an instance of a descriptor class to a class attribute in Python rather than use a property? -


i'm aware property is descriptor, there specific examples of when using descriptor class might more advantageous, pythonic, or provide benefit on using @property on method function?

better encapsulation , re-usability: descriptor class can have custom attributes set on instantiating. it's useful keep data confined in manner, instead of having worry getting set or overwritten on descriptor's owner.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -