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/

Reply via email to