syntax difference

Chris Angelico rosuav at gmail.com
Wed Jun 20 08:05:02 EDT 2018


On Wed, Jun 20, 2018 at 9:53 PM,  <bart4858 at gmail.com> wrote:
> Pointers are perhaps a more technical feature. Switch and case, the latter a more general version of switch, are universal.
>
>
> Repeat n times is universal. While it is trivial to implement with other constructs, it as an annoyance and distraction that is easily fixed.
>
> Now you will probably say it is possible to do without loops at all, or without selecting from one of multiple execution paths (by using functional approaches). I suggest that such features just make life a little simpler. (And make writing an efficient interpreter a little bit easier.)
>

Interesting that you want a "repeat N times" construct rather than
"for _ in range(n):", for efficiency; but you're happy to have
pointers, which prevent many forms of optimization. The instant you
have a pointer, you are forced to store that data at that location in
memory, in case something dereferences that pointer. Python, on the
other hand, is free to optimize things down to a stack, so long as
there's no semantic difference.

Also: how do you do memory management when you have pointers? Or do
you give that job to the programmer?

ChrisA



More information about the Python-list mailing list