Re: new and updateSome() argument format
Jacob Smullyan <[email protected]> Fri, 20 May 2005 20:29:36 -0400
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
On Fri, May 20, 2005 at 05:34:33PM -0400, Jacob Smullyan wrote:
> @classmethod
> def new(cls, **fieldData):
> return BaseClass.new(**X(fieldData))
>
> @classmethod
> def updateSome(cls, adict, *args, **fieldData):
> return BaseClass.updateSome(X(adict), *args, **fieldData)
>
> (I'm a little uncertain how to use super() in this situation, so I'm
> just punting on it.)
<OT xmlns:"http://digression.org/">
Just to keep myself honest, I now know that super works with
classmethods just as with instance methods:
@classmethod
def whatever(cls):
super(ThisClass, cls).whatever()
For static methods, there doesn't seem anything very attractive to do
with super(), however. I suppose super(ThisClass, ThisClass) would
work. super(type) returns an unbound super object, which is claimed
here* to be relevant to the case of calling static methods, actually
needs to be bound by calling .__get__(ThisClass) to get a bound one
before you can do anything, so that is equivalent.
* http://groups-beta.google.com/group/comp.lang.python/msg/b1107eb3222677d8?hl=en
</OT>
--
Jacob Smullyan
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCjoDwuqamFyFXXLIRAvuBAKDJhOLkYuURuxOptmjAUcci8WVQQQCgpDWx uQlm8t7YjV5Zv+mfOZD09qA= =yNGV -----END PGP SIGNATURE-----