On Sat, Sep 29, 2018 at 10:22 AM Dan Sommers
<2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 9/28/18 7:39 PM, Steven D'Aprano wrote:
> > But none of that compares to C undefined behaviour. People who think
> > that they are equivalent, don't understand C undefined behaviour.
>
> Well, yes:  Some syntactically legal C results in nasal demons, and some
> of that code is harder to spot than others.  AFAIK, syntactically legal
> Python can only do that if the underlying C code invokes undefined
> behaviour.

What should happen here?

>>> import ctypes
>>> ctypes.cast(id(1), ctypes.POINTER(ctypes.c_int))[6] = 0
>>> 1

Nothing here invokes C's undefined behaviour. Or what about here:

>>> import sys; sys.setrecursionlimit(2147483647)
>>> def f(): f()
...
>>> f()


Python has its own set of "well don't do that then" situations. In
fact, I would say that *most* languages do.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to