Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread Cameron Simpson
On 02Aug2019 11:26, bob gailer wrote: And now for something completely different... Decorators are not required to return a function! I use them to create a dictionary that maps function names to the corresponding function object. That is an interesting idea! But I want to counter it,

Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread bob gailer
And now for something completely different... Decorators are not required to return a function! I use them to create a dictionary that maps function names to the corresponding function object. This is very useful when associating actions with user-entered commands. Example: def

Re: [Tutor] Difference between decorator and inheritance

2019-08-02 Thread Mats Wichmann
On 7/31/19 11:57 AM, Gursimran Maken wrote: > Hi, > > Anyone could please let me know the difference between decorators and > inheritance in python. > > Both are required to add additional functionality to a method then why are > we having 2 separate things in python for doing same kind of work.

Re: [Tutor] Difference between decorator and inheritance

2019-08-01 Thread Alan Gauld via Tutor
On 31/07/2019 18:57, Gursimran Maken wrote: > Anyone could please let me know the difference between decorators and > inheritance in python. > > Both are required to add additional functionality to a method then why are > we having 2 separate things in python for doing same kind of work.