Benefit of using the super() method

I confirmed on my home laptop that super().__init__() is valid from Python 3.0 to Python 3.3.2. I just don't know how to make that code backwards compatible with at least Python 2.7. Any hints?

I confirmed on my home laptop that super().__init__() is valid from Python 3.0 to Python 3.3.2. I just don't know how to make that code backwards compatible with at least Python 2.7. Any hints?

Try and see if the py2 way works on py3 -- I suspect it does.

-Chris

···

On Thu, Jun 6, 2013 at 8:01 AM, "Boštjan Mejak" <mejak.bost@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

"Bo�tjan Mejak" wrote:

I confirmed on my home laptop that super().__init__() is valid from Python 3.0 to Python 3.3.2. I just don't know how to make that code backwards compatible with at least Python 2.7. Any hints?

super(derived,self).__init__() works clear back to Python 2. The
shorter syntax, super().__init__(), does not work in Python 2 and cannot
be made to work in Python 2. If you need both, don't use it. Just that
simple.

Once again, you have focused in with laser-like intensity on an
absolutely trivial point. super() is a convenience. Nothing more. You
have already wasted more time on this than you will ever save in using it.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Not to mention that this whole super() syntax is a ugly as it can get, for
a language as beautiful as Python.

Andrea.

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

    if mention_platform_and_version() and include_sample_app():
        send_message(email)
    else:
        install_malware()
        erase_hard_drives()
# ------------------------------------------------------------- #

···

On 6 June 2013 19:48, Tim Roberts wrote:

"Boštjan Mejak" wrote:
> I confirmed on my home laptop that super().__init__() is valid from
Python 3.0 to Python 3.3.2. I just don't know how to make that code
backwards compatible with at least Python 2.7. Any hints?

super(derived,self).__init__() works clear back to Python 2. The
shorter syntax, super().__init__(), does not work in Python 2 and cannot
be made to work in Python 2. If you need both, don't use it. Just that
simple.

Once again, you have focused in with laser-like intensity on an
absolutely trivial point. super() is a convenience. Nothing more. You
have already wasted more time on this than you will ever save in using it.

Which schmock named this built-in function “super” anyway? It’s just not right. I would have named it superclass(). It certainly tells you more clearly what is it supposed to be used for.

Plonk

···

On Thu, Jun 06, 2013 at 10:59:55PM +0200, Boštjan Mejak wrote:

Date: Thu, 6 Jun 2013 22:59:55 +0200
From: Boštjan Mejak <mejak.bost@gmail.com>
To: wxPython Mailing List <wxpython-users@googlegroups.com>
Subject: Re: [wxPython-users] Benefit of using the super() method

Which schmock named this built-in function "super" anyway? It's just not
right. I would have named it superclass(). It certainly tells you more
clearly what is it supposed to be used for.

It’s a mixed bag. “super” is standard shorthand found in Java. C++ doesn’t have a super since it supports multiple inheritance.

And it’s spelled “schmuck”.

···

On Thursday, June 6, 2013, Boštjan Mejak wrote:

Which schmock named this built-in function “super” anyway? It’s just not right. I would have named it superclass(). It certainly tells you more clearly what is it supposed to be used for.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

In Yiddish it is spelled “schmock”, thank you very much. :slight_smile:

edoc wrote:

It's a mixed bag. "super" is standard shorthand found in Java. C++
doesn't have a super since it supports multiple inheritance.

C# calls it "base". I'm not sure that's any better.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Tim, that name “base” isn’t any better either. :wink:

It depends on the vocabulary.� In C++, the participants in an
inheritance relationship are called the “base” class and the
“derived” class.� C# borrowed that terminology, although they
restricted inheritance to one “base” with zero or more interfaces
(which Python calls “mix-ins”).� In that environment, “base” is the
right word.

···

Bo�tjan Mejak wrote:

Tim, that name “base” isn’t any better either. :wink:

-- Tim Roberts, Providenza & Boekelheide, Inc.

timr@probo.com