Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-29 Thread Steven D'Aprano
On Sat, Dec 30, 2017 at 02:56:46AM +1100, Chris Angelico wrote: > On Sat, Dec 30, 2017 at 2:38 AM, Steven D'Aprano wrote: > > The lack of support for the `in` operator is a major difference, but > > there's also `len` (equivalent to "count the one bits"), superset > > and

[Python-ideas] Allow to compile debug extension against release Python in Windows

2017-12-29 Thread Ivan Pozdeev via Python-ideas
The Windows version of pyconfig.h has the following construct:     if defined(_DEBUG)    pragma comment(lib,"python37_d.lib")     elif defined(Py_LIMITED_API)    pragma comment(lib,"python3.lib")     else    pragma comment(lib,"python37.lib")     endif /* _DEBUG */ which

Re: [Python-ideas] Make MappingView inherit from Collection instead of Sized

2017-12-29 Thread Guido van Rossum
This sounds like a good observation. I recommend opening a bug and preparing a PR if you can (a PR would also help finding if there are any problems with the idea). On Dec 29, 2017 9:50 AM, "Yahya Abou 'Imran via Python-ideas" < python-ideas@python.org> wrote: > After I generate an UML diagram

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-29 Thread Chris Angelico
On Sat, Dec 30, 2017 at 3:56 AM, Stephan Hoyer wrote: > We already have a built-in immutable set for Python. It's called frozenset. This is true, but AIUI its API is based primarily on that of the (mutable) set. If you were creating a greenfield ImmutableSet class, what would

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-29 Thread Stephan Hoyer
We already have a built-in immutable set for Python. It's called frozenset. On Fri, Dec 29, 2017 at 10:56 AM Chris Angelico wrote: > On Sat, Dec 30, 2017 at 2:38 AM, Steven D'Aprano > wrote: > > The lack of support for the `in` operator is a major

[Python-ideas] Make MappingView inherit from Collection instead of Sized

2017-12-29 Thread Yahya Abou 'Imran via Python-ideas
After I generate an UML diagram from collections.abc, I found very strange that MappingView inherit from Sized instead of Collection (new in python 3.6). Yes, MappingView only define __len__ and not __iter__ and __contains__, but all of its subclasses define them (KeysView, ValuesView and

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-29 Thread Serhiy Storchaka
29.12.17 16:43, Nick Coghlan пише: On 29 December 2017 at 22:58, Erik Bray wrote: Okay, and it's broken. Broken in what way? It has a fairly extensive test suite in https://github.com/python/cpython/blob/master/Lib/test/test_index.py (and some additional indirect

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-29 Thread Chris Angelico
On Sat, Dec 30, 2017 at 2:38 AM, Steven D'Aprano wrote: > The lack of support for the `in` operator is a major difference, but > there's also `len` (equivalent to "count the one bits"), superset > and subset testing, various in-place mutator methods, etc. Java has a > BitSet

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-29 Thread Steven D'Aprano
On Fri, Dec 29, 2017 at 10:26:22PM +1100, Chris Angelico wrote: > On Fri, Dec 29, 2017 at 7:18 PM, Steven D'Aprano wrote: > > Since ints don't provide a set-like interface, they aren't strictly > > speaking bitsets. But in any case, nobody is stopping people from using > >

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-29 Thread Richard Damon
On 12/29/17 9:56 AM, Antoine Pitrou wrote: (*) I got curious and went through the maze of type definitions on GNU/Linux. Which gives: #define __S32_TYPEDEF __signed__ int #define __PID_T_TYPE__S32_TYPE __STD_TYPE __PID_T_TYPE __pid_t; typedef __pid_t pid_t; Regards Antoine.

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-29 Thread Antoine Pitrou
On Sat, 30 Dec 2017 00:43:07 +1000 Nick Coghlan wrote: > > > That doesn't change my other point that some > > functions that could previously take non-int arguments can no > > longer--if we agree on that at least then I can set about making a bug > > report and fixing it.

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-29 Thread Nick Coghlan
On 29 December 2017 at 22:58, Erik Bray wrote: > On Thu, Dec 28, 2017 at 8:42 PM, Serhiy Storchaka wrote: >> 28.12.17 12:10, Erik Bray пише: >>> >>> There's no index() alternative to int(). >> >> >> operator.index() > > Okay, and it's broken. Broken

Re: [Python-ideas] Is there a reason some of the PyLong_As* functions don't call an object's __int__?

2017-12-29 Thread Erik Bray
On Thu, Dec 28, 2017 at 8:42 PM, Serhiy Storchaka wrote: > 28.12.17 12:10, Erik Bray пише: >> >> There's no index() alternative to int(). > > > operator.index() Okay, and it's broken. That doesn't change my other point that some functions that could previously take non-int

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-29 Thread Chris Angelico
On Fri, Dec 29, 2017 at 7:18 PM, Steven D'Aprano wrote: > Since ints don't provide a set-like interface, they aren't strictly > speaking bitsets. But in any case, nobody is stopping people from using > sets of enum values. I'm not sure what "set-like interface" you'd be

Re: [Python-ideas] Internal function idea

2017-12-29 Thread Stephen J. Turnbull
On Sat, Dec 23, 2017, 09:23 William Rose, wrote: > I had an idea that it could be helpful to have local functions as > well as normal ones. They would be called the same way as normal > ones but def would be replaced by internal and inside they could > only access

Re: [Python-ideas] Internal function idea

2017-12-29 Thread Chris Angelico
On Fri, Dec 29, 2017 at 5:03 PM, Franklin? Lee wrote: > On Fri, Dec 29, 2017 at 1:01 AM, Chris Angelico wrote: >> On Fri, Dec 29, 2017 at 1:31 PM, Franklin? Lee >> wrote: >>> On Thu, Dec 28, 2017 at 5:21 AM, William

Re: [Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-29 Thread Steven D'Aprano
On Thu, Dec 28, 2017 at 12:23:53PM -0800, Paddy3118 wrote: > Hi Steve, I did not write an attack on the "Python devs". I didn't say you attacked anyone and your implication that I did is unfair. > Re-read my > original with a little less hostility and there should be room for an >