Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ellipsis #164

Open
jayvdb opened this issue May 29, 2021 · 7 comments
Open

Ellipsis #164

jayvdb opened this issue May 29, 2021 · 7 comments

Comments

@jayvdb
Copy link

jayvdb commented May 29, 2021

rapydscript-ng appears to have no support for ellipsis (...).

It seems like simply treating this as pass would be sufficient for most case, as its other use as a complex slicer e.g. in numpy, is unlikely to work in rapydscript for other reasons.

@kovidgoyal
Copy link
Owner

I prefer syntax errors, which are easy to detect and fix at compile
time, over runtime behavior that may or may not do what is expected.

@jayvdb
Copy link
Author

jayvdb commented May 29, 2021

Well it is easy enough to detect when ... is used as a statement instead of part of a subscript or other expression construct.

@kovidgoyal
Copy link
Owner

... is not a statement in python, its an expression that expression that
evaluates to the Ellipsis object, just like None evaluates to the None
object.

@jayvdb
Copy link
Author

jayvdb commented May 29, 2021

I meant it can be detected when the Ellipsis object is the only part of the statement, meaning it can be ignored, so that there is no ambiguous behaviour. Anyways, this isnt a major problem for me as I can easily remove them in a python ast rewrite phase before I invoking rapydscript.

@kovidgoyal
Copy link
Owner

Ah, I see, yes that's true. But why? Why allow ellipsis in one
context and not in lots of others? Seems fairly arbitrary.

@jayvdb
Copy link
Author

jayvdb commented May 29, 2021

Unlike statement pass, ... is a more versatile placeholder, so it is frequently used to indicate "not implemented" in a visually appealing way.

def foo(a, b):
    c = a + 1
    ...  # Need to do blah blah
    return c + b

It is a bit arbitrary, but it seems like an easy win for people who use it in that way.

@kovidgoyal
Copy link
Owner

OK, I can see some value in doing that. Not something I am particularly keen on since the only place I have ever seen/used ... as a statement is pyi files, but I will accept a patch for it.

@kovidgoyal kovidgoyal reopened this May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants