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 <[email protected]> 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 -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/XLURWAH6NURBVQSYUGTMK5TQTRD7LNFI/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
--
CALVIN SPEALMAN
SENIOR QUALITY ENGINEER
[email protected] 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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/RD2NVBS5XIBB3YCEVGDW5H6RFTQAGLUU/
Code of Conduct: http://python.org/psf/codeofconduct/