[Python-Dev] Extending os.chown() to accept user/group names

Antoine Pitrou solipsis at pitrou.net
Wed May 25 15:58:57 CEST 2011


On Wed, 25 May 2011 09:41:46 -0400
Barry Warsaw <barry at python.org> wrote:

> On May 25, 2011, at 10:24 AM, Sandro Tosi wrote:
> 
> >before opening an issue to track the request, I'd like to ask advice
> >here about this: extend os.chown() to accept even user/group names
> >instead of just uid and gid.
> >
> >On a Unix system, you can call chown command passing either id or
> >names, so it seems (to me at least) natural to expect os.chown() to
> >behave similarly; but that's not the case.
> >
> >I can see os module wants to be a thin wrapper around OS syscalls and
> >chown(2) accepts only uid/gid as input, so what would be best: extend
> >os.chown() or provide a chown() function in shutil module for this
> >purpose?
> 
> I think it would be a nice feature, and I can see the conflict.  OT1H you want
> to keep os.chown() a thin wrapper, but OTOH you'd rather not have to add a
> new, arguably more difficult to discover, function.  Given those two choices,
> I still think I'd come down on adding a new function and shutil.chown() seems
> an appropriate place for it.

+1 for shutil.chown().

Regards

Antoine.




More information about the Python-Dev mailing list