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

2017-12-26 Thread Steven D'Aprano
On Tue, Dec 26, 2017 at 12:07:52PM -0800, Paddy3118 wrote: > Maybe it is time to deemphasize the creation and passing of what is, in > effect, bit-sets as a single > argument, and instead promote the passing of a set of members of an > enum.Enum

Re: [Python-ideas] Internal function idea

2017-12-26 Thread Franklin? Lee
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] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

2017-12-26 Thread Neil Girdhar
Wouldn't it be more pythonic to just pass flags to re.compile as Boolean keyword arguments? On Tuesday, December 26, 2017 at 3:07:52 PM UTC-5, Paddy3118 wrote: > > Maybe it is time to deemphasize the creation and passing of what is, in > effect, bit-sets

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

2017-12-26 Thread Paddy3118
Maybe it is time to deemphasize the creation and passing of what is, in effect, bit-sets as a single argument, and instead promote the passing of a set of members of an enum.Enum constants. Thi comes about

Re: [Python-ideas] Internal function idea

2017-12-26 Thread Brett Cannon
[removing Python-ideas-owner so any replies don't flood my inbox] 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

Re: [Python-ideas] __intancehook__ special method

2017-12-26 Thread Yahya Abou 'Imran via Python-ideas
Well, I fact, I was playing with metaclasses and descriptors, and I was thinking about a way to use the famous variable annotation to instatiate decrptors like this: class Point(metaclass=MyMeta): x: int y: int class Circle(metaclass=MyMeta): center: Point radius:

Re: [Python-ideas] __intancehook__ special method

2017-12-26 Thread Paul Moore
On 26 December 2017 at 09:13, Yahya Abou 'Imran via Python-ideas wrote: > In a personnal project I feel the need (or the desire) to implement > something like this: > > assert isinstance(1, PositiveInteger) > assert not isinstance(-1, PositiveInteger) To me, this seems

[Python-ideas] __intancehook__ special method

2017-12-26 Thread Yahya Abou 'Imran via Python-ideas
Hello everybody! In a personnal project I feel the need (or the desire) to implement something like this: assert isinstance(1, PositiveInteger) assert not isinstance(-1, PositiveInteger) So I began looking a lot in the abc module, and I end unp using an __instancehook__ special method wich is