Skip to content

Improve usability of regexp and other functions #1446

Description

@timsaucer

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

In functions like regexp_count we have definition like this:

def regexp_count(
    string: Expr, pattern: Expr, start: Expr | None = None, flags: Expr | None = None
) -> Expr:

It is a common pattern that the pattern is a string, the start is an integer, and flags is a string (or single character).

It would be more pythonic if we can just pass those values without wrapping them in a lit() call.

Describe the solution you'd like

Review the regexp functions in the function library and find other common patterns.

For each allow users to not have to specify a Expr. We do this in other places in the code, so a pattern is already established.

Activity

  1. ntjohnson1 commented on Apr 8, 2026

    @ntjohnson1
    Contributor

    I came here to post about this as well. I think a good check on this is the ability to remove lit from all (or nearly all) doctest examples.
    Hit this recently around a bunch of string functions. strpos, array_to_string etc

  2. renato2099 commented on Apr 13, 2026

    @renato2099
    Contributor

    Hi @timsaucer @ntjohnson1 , I took a stab at this over in #1493 , if you think it is in the right direction, I can expand that to other functions. The current change is only on the python side since there is no "real" problem in the rust side as far as I see .
    Anyway, let me know what you guys think. Thanks!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions