Re: [Python-ideas] Allow random.choice, random.sample to work on iterators

2016-12-01 Thread Sjoerd Job Postmus
On Wed, Nov 30, 2016 at 02:32:54PM -0600, Nick Timkovich wrote: > a generator with known length that's not indexable (a rare beast?). Not as rare as you might think: >>> k = set(range(10)) >>> len(k) 10 >>> k[3] Traceback (most recent call last): File "", line 1, in TypeError: 'set' object

Re: [Python-ideas] Leave off "else" in ternary expression

2016-10-28 Thread Sjoerd Job Postmus
On Fri, Oct 28, 2016 at 11:28:16AM -0400, Todd wrote: > The null-coalescing discussion made me think about the current ternary "x = > a if b else c" expression. In normal "if / else" clauses, the "else" is > optional. I propose doing the same thing with ternary expressions > (although I don't

Re: [Python-ideas] Fwd: unpacking generalisations for list comprehension

2016-10-26 Thread Sjoerd Job Postmus
On Thu, Oct 27, 2016 at 03:27:07AM +1100, Steven D'Aprano wrote: > I think that there is zero hope of consistency for * the star operator. > That horse has bolted. It is already used for: > > - ... > - "zero or more of the previous element" in regular expressions > - "zero or more of any

Re: [Python-ideas] Proposal for default character representation

2016-10-14 Thread Sjoerd Job Postmus
On Fri, Oct 14, 2016 at 08:05:40AM +0200, Mikhail V wrote: > Any critics on it? Besides not following the unicode consortium. Besides the other remarks on "tradition", I think this is where a big problem lies: We should not deviate from a common standard (without very good cause). There are

Re: [Python-ideas] Fwd: Fwd: unpacking generalisations for list comprehension

2016-10-13 Thread Sjoerd Job Postmus
After having followed this thread for a while, it occured to me that the reason that the idea is confusing, is because the spelling is confusing. I think the suggested spelling (`*`) is the confusing part. If it were to be spelled `from ` instead, it would be less confusing. Consider this:

Re: [Python-ideas] Add "equal" builtin function

2016-10-06 Thread Sjoerd Job Postmus
On Thu, Oct 06, 2016 at 02:45:11PM +, אלעזר wrote: > It is a real problem. People are used to write `seq == [1, 2, 3]` and it > passes unnoticed (even with type checkers) that if seq changes to e.g. a > tuple, it will cause subtle bugs. It is inconvenient to write `len(seq) == > 3 and seq ==

Re: [Python-ideas] Add "equal" builtin function

2016-10-06 Thread Sjoerd Job Postmus
On Thu, Oct 06, 2016 at 03:01:36PM +0100, Paul Moore wrote: > On 6 October 2016 at 14:45, Filipp Bakanov wrote: > > For now there are many usefull builtin functions like "any", "all", etc. I'd > > like to propose a new builtin function "equal". It should accept iterable, > >