[Python-ideas] More friendly access to chmod

Mahmoud Hashemi mahmoud at hatnote.com
Mon Jan 11 22:10:10 EST 2016


Seems like the committee has some designs after all?

FilePerms
<http://boltons.readthedocs.org/en/latest/fileutils.html#boltons.fileutils.FilePerms>
is tested, on PyPI, and is even 2/3 compatible. And notice the lack of
"chmod" as a noun. ;)

Mahmoud
github.com/mahmoud

On Mon, Jan 11, 2016 at 4:12 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Tue, Jan 12, 2016 at 7:44 AM, Andrew Barnert <abarnert at yahoo.com>
> wrote:
> > On Jan 11, 2016, at 08:53, Chris Angelico <rosuav at gmail.com> wrote:
> >>
> >>> On Tue, Jan 12, 2016 at 3:49 AM, Andrew Barnert <abarnert at yahoo.com>
> wrote:
> >>>> On Jan 11, 2016, at 04:02, Ram Rachum <ram at rachum.com> wrote:
> >>>>
> >>>> I've chosen += and -=, despite the fact they're not set operations,
> because Python doesn't have __inand__.
> >>>
> >>> For a property that acts like a number, and presumably is implemented
> as a subclass of int, this seems like a horribly confusing idea.
> >>
> >> I would expect it NOT to be a subclass of int, actually - just that it
> >> has __int__ (and maybe __index__) to convert it to one.
> >
> > If you read his proposal, he wants oct(path.chmod) to work. That doesn't
> work on types with __int__.
> >
> > Of course it does work on types with __index__, but that's because the
> whole point of __index__ is to allow your type to act like an actual int
> everywhere that Python expects an int, rather than just something coercible
> to int. The point of PEP
> > 357 was to allow numpy.int64 to act as close to a subtype of int as
> possible without actually being a subtype.
>
> This is what I get for not actually testing stuff. I thought having
> __int__ would work for oct. In that case, I would simply recommend
> dropping that part of the proposal; retrieving the octal
> representation can be spelled oct(int(x)), or maybe x.octal or
> x.octal(). This is NOT an integer; it's much closer to a set of
> bitwise enumeration.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160111/ab957206/attachment.html>


More information about the Python-ideas mailing list