Re: [Python-ideas] PEP 531: Existence checking operators

2016-10-29 Thread Nick Coghlan
On 29 October 2016 at 21:44, Steven D'Aprano wrote: > On Fri, Oct 28, 2016 at 06:30:05PM +1000, Nick Coghlan wrote: > > [...] >> 1. Do we collectively agree that "existence checking" is a useful >> general concept that exists in software development and is distinct >> from

Re: [Python-ideas] Null coalescing operator

2016-10-29 Thread Mikhail V
On 29 October 2016 at 18:19, Stephen J. Turnbull wrote: >> For better or worse, it may be emoji that drive that change ;-) >> >> I suspect that the 100 million or so Chinese, Japanese, Korean, and >> Indian programmers who have had systems that have no trouble >> whatsoever handling non-ASCII for

Re: [Python-ideas] SI scale factors alone, without units or dimensional analysis

2016-10-29 Thread Nick Timkovich
Ah, always mess up micro = 6/9 until I think about it for half a second. Maybe a "n" suffix could have saved me there ;) For "long" numbers there's the new _ so you can say 0.000_000_1 if you so preferred for 0.1 micro (I generally see _ as more useful for high-precison numbers with more non-zero

Re: [Python-ideas] Null coalescing operator

2016-10-29 Thread Paul Moore
On 29 October 2016 at 18:19, Stephen J. Turnbull wrote: >> For better or worse, it may be emoji that drive that change ;-) > > I suspect that the 100 million or so Chinese, Japanese, Korean, and > Indian programmers who have had systems that have no trouble >

Re: [Python-ideas] SI scale factors alone, without units or dimensional analysis

2016-10-29 Thread Todd
On Sat, Oct 29, 2016 at 12:43 PM, Nick Timkovich wrote: > From that page: > >> User-defined literals are basically normal function calls with a fancy >> syntax. [...] While user defined literals look very neat, they are not much >> more than syntactic sugar. There is not

Re: [Python-ideas] Null coalescing operator

2016-10-29 Thread Stephen J. Turnbull
Steven d'Aprano writes: > I think you mean WHITE SQUARE? At least, I can not see any "OPEN > SQUARE" code point in Unicode, and the character you use below □ > is called WHITE SQUARE. You're right, I just used a common Japanese name for it. I even checked the table to make sure it was BMP

Re: [Python-ideas] PEP 531: Existence checking operators

2016-10-29 Thread Ryan Gonzalez
On Oct 28, 2016 3:30 AM, "Nick Coghlan" wrote: > *snip* > > 1. Do we collectively agree that "existence checking" is a useful > general concept that exists in software development and is distinct > from the concept of "truth checking"? I'd hope so! > 2. Do we collectively

Re: [Python-ideas] Deterministic iterator cleanup

2016-10-29 Thread Neil Girdhar
On Tuesday, October 25, 2016 at 6:26:17 PM UTC-4, Nathaniel Smith wrote: > > On Sat, Oct 22, 2016 at 9:02 AM, Nick Coghlan > wrote: > > On 20 October 2016 at 07:02, Nathaniel Smith > wrote: > >> The first change is to replace the outer for loop with a

Re: [Python-ideas] PEP 531: Existence checking operators

2016-10-29 Thread Ryan Birmingham
I certainly like the concept, but I worry that use of __exists__() could generalize it a bit beyond what you're intending in practice. It seems like this should only check if an object exists, and that adding the magic method would only lead to confusion. -Ryan Birmingham On 28 October 2016 at

Re: [Python-ideas] SI scale factors alone, without units or dimensional analysis

2016-10-29 Thread Nick Timkovich
>From that page: > User-defined literals are basically normal function calls with a fancy > syntax. [...] While user defined literals look very neat, they are not much > more than syntactic sugar. There is not much difference between defining > and calling a literal operator with "foo"_bar and

Re: [Python-ideas] PEP 531: Existence checking operators

2016-10-29 Thread Steven D'Aprano
On Fri, Oct 28, 2016 at 06:30:05PM +1000, Nick Coghlan wrote: [...] > 1. Do we collectively agree that "existence checking" is a useful > general concept that exists in software development and is distinct > from the concept of "truth checking"? Not speaking for "we", only for myself: of course.

Re: [Python-ideas] PEP 531: Existence checking operators

2016-10-29 Thread Steven D'Aprano
On Sat, Oct 29, 2016 at 02:52:42PM +1000, Nick Coghlan wrote: > On 29 October 2016 at 04:08, Mark Dickinson wrote: > > On Fri, Oct 28, 2016 at 9:30 AM, Nick Coghlan wrote: > >> [...] the current practicises of: > >> > >> * obj is not None (many different

Re: [Python-ideas] PEP 531: Existence checking operators

2016-10-29 Thread Steven D'Aprano
On Sat, Oct 29, 2016 at 03:03:22PM +1000, Nick Coghlan wrote: > On 29 October 2016 at 01:46, Ryan Gonzalez wrote: > > On Oct 28, 2016 3:30 AM, "Nick Coghlan" wrote: > >> *snip* > >> 4. Do we collectively agree that "?then" and "?else" would be > >>

Re: [Python-ideas] PEP 531: Existence checking operators

2016-10-29 Thread Paul Moore
On 29 October 2016 at 07:21, Nick Coghlan wrote: > A short-circuiting if-else protocol for arbitrary "THEN if COND else > ELSE" expressions could then look like this: > > _condition = COND > if _condition: > _then = THEN > if hasattr(_condition,

Re: [Python-ideas] Null coalescing operator

2016-10-29 Thread Steven D'Aprano
On Sat, Oct 29, 2016 at 11:02:36AM +0900, Stephen J. Turnbull wrote: > Unfortunately here the most plausible syntax is one > that Guido has said he definitely doesn't like: using '?'. The > alternatives are pretty horrible (a Haskell-like 'maybe' keyword, or > the OPEN SQUARE character used by