[issue23591] Add IntFlags

2016-07-10 Thread Ethan Furman

Ethan Furman added the comment:

I don't think I'll have this in before the next alpha (today? tomorrow?) but 
I'll get it merged in the next couple weeks (need to do some integration work 
with the other Enum enhancements).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2016-07-06 Thread Ethan Furman

Ethan Furman added the comment:

Reviewing...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2016-07-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping again.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2016-06-21 Thread Ethan Furman

Ethan Furman added the comment:

Just look briefly through your patches, and they look pretty good.  I'll take a 
more in-depth look in the next couple weeks.  (Feel free to ping again if you 
don't see any activity from me, and thanks for your patience.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2016-06-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What should be done for landing this in 3.6?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-07-21 Thread Ethan Furman

Ethan Furman added the comment:

My experience is that a module maintainer, or somebody claiming to speak for 
the module maintainer, can close any issue in their area at any time regardless 
of the number of core devs in favor of a change.

Whatever.  I'll leave this open and write up a spec of what IntFlags should 
look like in case somebody wants to write the patch for it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-07-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why have you rejected this issue Ethan? I think this is useful feature and must 
be in Python, and other core developers agreed with this. Only minor 
implementation details are discussable.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-07-21 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
resolution:  - rejected
stage: patch review - 
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-07-21 Thread R. David Murray

R. David Murray added the comment:

Ethan: to clarify...based on my years of watching this tracker, the way we 
normally handle an issue like this is to leave the issue open until it is 
resolved, sometimes with people proposing competing patches.  (There might be 
reasons to change that tradition, but if so the forum for that discussion would 
be python-workflow.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-07-21 Thread R. David Murray

R. David Murray added the comment:

I agree.  Closing this does not follow our normal development workflow, since 
there has been a consensus in favor and none for rejection.  If you think the 
API needs wider discussion a new thread can be started on python-ideas.

--
nosy: +r.david.murray
resolution: rejected - 
status: closed - open
versions: +Python 3.6 -Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I choose repr() so that for single flag it looks as for IntEnum instance. Other 
variants except Perm.R|Perm.W: 3 have different format. Perm.R|Perm.W: 3 is 
too verbose, it repeats the same class name multiple times.

But I don't like current repr.

Other operators are not overridden for purpose. IntFlags is int and can be used 
in all cases when int is used, but not in all cases the result should preserve 
the type. FLAG1 + FLAG2 works as if flags would be ints, but it should be 
rewritten to FLAG1 | FLAG2 to got the benefit from using IntFlags.

However I forgot to override the exclusive-or operator. It should be overridden.

Updated patch changes str and repr, override the exclusive-or operator and adds 
some documentation.

--
Added file: http://bugs.python.org/file38387/intflags_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-03-07 Thread Martin Panter

Martin Panter added the comment:

It would make more sense and be more consistent if the str() and repr() used 
one’s complement in all cases, i.e.:

self.assertEqual(str(Perm(~0)), ~0)

Also, the repr() seems to be doing a bad attempt at Python pseudo code. Instead 
of

Perm.R|W: 3

maybe it could be something like these:

Perm.R|Perm.W: 3  # Mirroring str() - Perm.R|Perm.W
Perm R|W: 3
Perm: R|W = 3

I wonder if the addition (+) operator should also be overridden; I haven’t 
looked, but I suspect some people may do FLAG1 + FLAG2 instead of FLAG1 | FLAG2.

--
nosy: +vadmium

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-03-07 Thread Ethan Furman

Ethan Furman added the comment:

The current patch is more along the lines of a proof-of-concept.

The final IntFlag type (if there is one) would be quite a bit more extensive 
since part of the reason for its existence is to not lose type -- so pretty 
much every __op__ would have to be overridden.

Agreed about the repr() and str(), though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-03-05 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-03-05 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here is preliminary implementation of IntFlags (no docs). This is an int 
subclass purposed to represent a set of integer flags. It supports named 
constants (as IntEnum), supports bitwise operations (, |, ~) and has funny str 
and repr. See discussion on Python-Ideas [1].

The patch includes tests and few examples of using IntFlags in the stdlib.

[1] http://comments.gmane.org/gmane.comp.python.ideas/32267

--
components: Library (Lib)
files: intflags.patch
keywords: patch
messages: 237269
nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add IntFlags
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file38344/intflags.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23591] Add IntFlags

2015-03-05 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
assignee:  - ethan.furman

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23591
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com