[Python-ideas] Tighten up the formal grammar and parsing a bit?
Pavol Lisy
pavol.lisy at gmail.com
Mon May 15 12:21:50 EDT 2017
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 <rymg19 at gmail.com> wrote:
> 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" <storchaka at gmail.com> wrote:
>
>> 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 cond:
>> stmt2
>> else:
>> stmt1
>>
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
More information about the Python-ideas
mailing list