Python "object" as root object
John A Meinel
john at arbash-meinel.com
Thu May 26 05:32:31 BST 2005
Martin Pool wrote:
>On 25 May 2005, John A Meinel <john at arbash-meinel.com> wrote:
>
>
>>John A Meinel wrote:
>>
>>
>>
>>>Since you seem to be okay adding it, I will submit a patch. :)
>>>
>>>John
>>>=:->
>>>
>>>
>>>
>>As promised. Really this is just:
>>grep -rn "^class.*[^)]:" *
>>and
>>sed -e 's/(^class.*[^)]):/\1(object):/'
>>
>>(though I used vim for the last part, so my syntax may be a little off).
>>
>>It might just be easier for you to do it, it only takes a couple of seconds.
>>
>>
>
>OK, done.
>
>(It seems that method decorators like classmethod and staticmethod do
>work ok with old-style classes though.)
>
>
classmethod/staticmethod aren't decorators in the 'decorators' sense.
They return a new function object. Decorators are something like:
class myclass:
@classmethod
def test(cls, x, y):
pass
I don't claim to understand them very well, but the idea is to put them
*before* you declare the function, so that the information is all near
eachother.
And I'm sure 'super' doesn't work with old-style classes.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050525/41127567/attachment.pgp
More information about the bazaar
mailing list