Skip to content

Sharpen type annotation of _get_arg_id_to_arg_and_arg_id_to_descr #296

Open

Description

@nkoskelo

According to the type listed args: tuple[Any, ...], args should be able to support an object type. However, it does not. Passing in an object that is not an pt.Array or scalar or ArrayContainer returns an error message. I think we should just return the descriptor as the position of the object within the args tuple.

Activity

  1. changed the title [-]_get_arg_id_to_arg_and_arg_id_to_descr does not support all input arg types[/-] [+]Sharpen type annotation of `_get_arg_id_to_arg_and_arg_id_to_descr`[/+] on Jan 16, 2025
  2. inducer commented on Jan 16, 2025

    @inducer
    Owner

    First, a point about the Any type annotation (https://en.wikipedia.org/wiki/Gradual_typing): Any does not mean "you can pass any-and-everything". It represents that no precise information is available, and the type checker should accept any-and-everything.

    Annotations of Any are by their nature stopgaps and should, over time, be replaced by more precise ones. (Here, ArrayOrContainer comes to mind.)

    For your specific situation, there is currently no support for passing non-(array or container) arguments to actx.compile'd functions. For correctness, we would have to recompile for each new value, and when we considered it, we did not see many uses cases for that.

    • It might be good to record that as a design decision in the docs.

    All that said, what's the use case you have in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions