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

Re: [Libguestfs] RHashtable and the python bindings



On Wed, Apr 03, 2013 at 05:29:57PM +0100, Matthew Booth wrote:
> I've discovered that libguestfs apis which return RHashtable are
> currently returned as a list of tuples in the python bindings rather
> than the obvious dict. I propose fixing this, whilst also maintaining
> API compatibility for a period of time.
> 
> The following apis return RHashtable:
> 
> inspect_get_mountpoints
> list_filesystems
> inspect_get_drive_mappings
> tune2fs_l
> mountpoints
> md_detail
> blkid
> list_disk_labels
> 
> I propose the following:
> 
> h = guestfs.GuestFS(return_dict=True)
> 
> If return_dict is set, any RHashtable api would return a dict rather
> than a list of tuples. If not, the behaviour would be unchanged. The
> default would be False.

Although it's not very likely, it is better to avoid a conflict with a
future guestfs_create_flags flag by calling the flag
'python_return_dict'.

Apart from that, it looks fine to me.

Rich.

> We would advertise immediately that this parameter is recommended for
> all new code, and that old code should be updated. At some point in the
> future the default would be changed to True, and at some point after
> that the old code could be removed.
> 
> Matt
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs redhat com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)


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