An alternative suggestion, which works today (... is a valid object called
Ellipsis):

   Foobar.search(
        attr1="foo",
        attr2=[10, ...],
        attr3=[42, ..., 50]
    )

On Thu, Aug 12, 2021 at 8:44 AM <eloi.riv...@aquilenet.fr> wrote:

> Hi. I am working on a kinda-ORM library, which usage often implies to
> request data within specific ranges:
>
>      Foobar.search(
>         attr1="foo",
>         attr2=gt(10),
>         attr3=between(42, 50)
>     )
>
> The use of "gt" or "between" methods to describe those operations feels a
> bit cumbersome (as it is long to write, and you need to import those
> functions in a lot of files), and I though it could be more pythonic to use
> slices instead.
>
>      Foobar.search(
>         attr1="foo",
>         attr2=slice(10),
>         attr3=slice(42, 50)
>     )
>
> I suggest an alternative way to instanciate slices, that would look like
> this:
>
>      Foobar.search(
>         attr1="foo",
>         attr2=[10:],
>         attr3=[42:50]
>     )
>
> What do you think?
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/XLURWAH6NURBVQSYUGTMK5TQTRD7LNFI/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>

-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

calvin.speal...@redhat.com  M: +1.336.210.5107
[image: https://red.ht/sig] <https://red.ht/sig>
TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RD2NVBS5XIBB3YCEVGDW5H6RFTQAGLUU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to