Re: [PATCH] Make python objects inherit from 'object' base class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 24, 2013 at 01:17:32PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> As of python >= 2.2, it is recommended that all objects inherit
> from the 'object' base class. We already require python >= 2.3
> for libvirt for thread macro support, so we should follow this
> best practice.
> 
> See also
> 
>   http://stackoverflow.com/questions/4015417/python-class-inherits-object
> 
> This is motivated the patch Rich just did for libguestfs
> 
>   https://www.redhat.com/archives/libguestfs/2013-January/msg00063.html
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  python/generator.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/python/generator.py b/python/generator.py
> index f853d77..a079fc5 100755
> --- a/python/generator.py
> +++ b/python/generator.py
> @@ -1413,7 +1413,7 @@ def buildWrappers(module):
>                  classes.write("        %s.__init__(self, _obj=_obj)\n\n" % (
>                                classes_ancestor[classname]))
>              else:
> -                classes.write("class %s:\n" % (classname))
> +                classes.write("class %s(object):\n" % (classname))
>                  if classname in [ "virDomain", "virNetwork", "virInterface", "virStoragePool",
>                                    "virStorageVol", "virNodeDevice", "virSecret","virStream",
>                                    "virNWFilter" ]:

ACK.

I found a good discussion of what this is all about here:

http://docs.python.org/release/2.2.3/whatsnew/sect-rellinks.html

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]