[Tutor] inheritance and super() function in python
Steven D'Aprano
steve at pearwood.info
Wed Apr 23 03:41:28 CEST 2014
On Tue, Apr 22, 2014 at 08:59:59PM -0400, Jorge Leon wrote:
> Thank you Steve and Dave for the prompt response and advise, and sorry
> about the format.
>
> The version of Python I'm working under is 2.7.5. About the .super():
> I'm going to try out the format you gave me for the files, and yes:
> that's exactly how I had it. Something that has stuck from all the C++
> programming I'm doing, which also leads me to believe that it may be
> better for me to step away from using .super() if I don't get the
> program to work as intended when I apply your advise.
Using super() is fine. (Note that super is a function, not a method --
there is no dot at the front.) You just have to remember to inherit from
object (or some other built-in type).
You might like to read this to understand why there is a difference
between inheriting from object and not:
http://import-that.dreamwidth.org/3098.html
--
Steven
More information about the Tutor
mailing list