Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Brendan Barnwell
On 2017-10-17 07:26, Serhiy Storchaka wrote: 17.10.17 17:06, Nick Coghlan пише: >Keep in mind we're not talking about a regular loop you can break out of >with Ctrl-C here - we're talking about a tight loop inside the >interpreter internals that leads to having to kill the whole host >process ju

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Koos Zevenhoven
On Tue, Oct 17, 2017 at 5:26 PM, Serhiy Storchaka wrote: > 17.10.17 17:06, Nick Coghlan пише: > >> Keep in mind we're not talking about a regular loop you can break out of >> with Ctrl-C here - we're talking about a tight loop inside the interpreter >> internals that leads to having to kill the w

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Serhiy Storchaka
17.10.17 17:06, Nick Coghlan пише: Keep in mind we're not talking about a regular loop you can break out of with Ctrl-C here - we're talking about a tight loop inside the interpreter internals that leads to having to kill the whole host process just to get out of it. And this is the root of t

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Nick Coghlan
On 17 October 2017 at 23:17, Koos Zevenhoven wrote: > On Tue, Oct 17, 2017 at 2:46 PM, Serhiy Storchaka > wrote: > >> 17.10.17 14:10, Nick Coghlan пише: >> >>> 1. It's pretty easy to write "for x in y in y" when you really meant to >>> write "for x in y", and if "y" is an infinite iterator, the

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Nick Coghlan
On 17 October 2017 at 21:46, Serhiy Storchaka wrote: > 17.10.17 14:10, Nick Coghlan пише: > >> 1. It's pretty easy to write "for x in y in y" when you really meant to >> write "for x in y", and if "y" is an infinite iterator, the "y in y" part >> will become an unbreakable infinite loop when exec

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Koos Zevenhoven
On Tue, Oct 17, 2017 at 2:46 PM, Serhiy Storchaka wrote: > 17.10.17 14:10, Nick Coghlan пише: > >> 1. It's pretty easy to write "for x in y in y" when you really meant to >> write "for x in y", and if "y" is an infinite iterator, the "y in y" part >> will become an unbreakable infinite loop when

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Serhiy Storchaka
17.10.17 14:10, Nick Coghlan пише: 1. It's pretty easy to write "for x in y in y" when you really meant to write "for x in y", and if "y" is an infinite iterator, the "y in y" part will become an unbreakable infinite loop when executed instead of the breakable one you intended (especially annoy

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Nick Coghlan
On 17 October 2017 at 19:19, Serhiy Storchaka wrote: > 17.10.17 09:42, Nick Coghlan пише: > >> On 17 October 2017 at 16:32, Nick Coghlan > ncogh...@gmail.com>> wrote: >> >> So this sounds like a reasonable API UX improvement to me, but you'd >> need to ensure that you don't inadvertently

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Nick Coghlan
On 17 October 2017 at 17:44, Steven D'Aprano wrote: > On Tue, Oct 17, 2017 at 04:42:35PM +1000, Nick Coghlan wrote: > > > I should also note that there's another option here beyond just returning > > "False": it would also be reasonable to raise an exception like > > "RuntimeError('Attempted nega

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Serhiy Storchaka
17.10.17 09:42, Nick Coghlan пише: On 17 October 2017 at 16:32, Nick Coghlan > wrote: So this sounds like a reasonable API UX improvement to me, but you'd need to ensure that you don't inadvertently change the external behaviour of *successful* containment

Re: [Python-ideas] Why not picoseconds?

2017-10-17 Thread Koos Zevenhoven
Replying to myself again here, as nobody else said anything: On Mon, Oct 16, 2017 at 5:42 PM, Koos Zevenhoven wrote: > > > ​Indeed. And some more on where the precision loss comes from: > > When you measure time starting from one point, like 1970, the timer > reaches large numbers today, like 10*

Re: [Python-ideas] Membership of infinite iterators

2017-10-17 Thread Steven D'Aprano
On Tue, Oct 17, 2017 at 04:42:35PM +1000, Nick Coghlan wrote: > I should also note that there's another option here beyond just returning > "False": it would also be reasonable to raise an exception like > "RuntimeError('Attempted negative containment check on infinite iterator')". I don't think