Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.python
Re: Super() function
Gabriel Genellina
3/25/2010 4:00:00 AM
En Thu, 25 Mar 2010 00:17:52 -0300, Alan Harris-Reid
<aharrisreid@googlemail.com> escribió:
> Using Python 3.1, I sometimes use the super() function to call the
> equivalent method from a parent class, for example
>
> def mymethod(self):
> super().mymethod()
> some more code...
>
> Is there any way of writing the code so that the super() call is generic
> and automatically recognises the name of the current method (ie.
> something like super().thismethod()) or do I always have to repeat the
> method name after super()?
This recipe does what you want:
http://code.activestate.com/recipes/286195-...
(but requires a bit of black magic...)
--
Gabriel Genellina
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Super() function
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password