Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-18 Thread Steven D'Aprano
On Mon, May 15, 2017 at 11:17:48PM +1000, Chris Angelico wrote: > On Mon, May 15, 2017 at 11:00 PM, Steven D'Aprano wrote: > > There's also cases where > > > > if x > y: > > pass > > else: > > code > > > > is *not necessarily* the same as > > > > if not (x > y): > >

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Serhiy Storchaka
On 15.05.17 18:46, Ryan Gonzalez wrote: I guess maybe if you overload the operators to return broken objects, maybe then they would be different? No. The compiler generates an equivalent bytecode for both cases. ___ Python-ideas mailing list Python-i

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Pavol Lisy
Something broken like this? import inspect def cond(): if 'not cond' in inspect.stack()[1].code_context[0]: return False return True if cond(): print('yes') else: print('no') if not cond(): print('no') else: print('yes') On 5/15/17, Ryan Gonzalez wrote: > I gues

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Ryan Gonzalez
I guess maybe if you overload the operators to return broken objects, maybe then they would be different? -- Ryan (ライアン) Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else http://refi64.com On May 15, 2017 9:50 AM, "Serhiy Storchaka" wrote: > On 15.05.17 16:00, Steven D'

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Serhiy Storchaka
On 15.05.17 16:00, Steven D'Aprano wrote: There's also cases where if x > y: pass else: code is *not necessarily* the same as if not (x > y): code This is not true. if not cond: stmt1 else: stmt2 always is equivalent to if co

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Chris Angelico
On Mon, May 15, 2017 at 11:00 PM, Steven D'Aprano wrote: > On Mon, May 15, 2017 at 08:13:48PM +1000, Chris Angelico wrote: >> On Mon, May 15, 2017 at 7:38 PM, Hugh Fisher wrote: >> > I wrote this little Python program using CPython 3.5.2. It's ... >> > interesting ... that we apparently don't nee

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Steven D'Aprano
On Mon, May 15, 2017 at 08:13:48PM +1000, Chris Angelico wrote: > On Mon, May 15, 2017 at 7:38 PM, Hugh Fisher wrote: > > I wrote this little Python program using CPython 3.5.2. It's ... > > interesting ... that we apparently don't need comments or pass > > statements any more. Anyone else think i

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Steven D'Aprano
On Mon, May 15, 2017 at 07:38:29PM +1000, Hugh Fisher wrote: > I wrote this little Python program using CPython 3.5.2. It's ... > interesting ... that we apparently don't need comments or pass > statements any more. I'm not sure what you mean by "any more". The code you give works, unchanged, a

Re: [Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Chris Angelico
On Mon, May 15, 2017 at 7:38 PM, Hugh Fisher wrote: > I wrote this little Python program using CPython 3.5.2. It's ... > interesting ... that we apparently don't need comments or pass > statements any more. Anyone else think it might be worth tightening up > the grammar definition and parser a bit

[Python-ideas] Tighten up the formal grammar and parsing a bit?

2017-05-15 Thread Hugh Fisher
I wrote this little Python program using CPython 3.5.2. It's ... interesting ... that we apparently don't need comments or pass statements any more. Anyone else think it might be worth tightening up the grammar definition and parser a bit? def empty(): """Don't do anything""" def helloWorld()