It's really not a worthwhile win. It captures a tiny fraction of Pandas style filtering while complicating the syntax of Python. Here's another Pandas filter: db[db.x < 1] No help there with the next syntax. Here's another: db[(db.x == 1) | (db.y == 2)] A much better idea doesn't require any changes in Python, just a clever class method. Pandas did this for a while, but deprecated it because... reasons. Still, the OP is free to create his version: db['x=1'] Or db['x<1'] db['x=1 or y=2'] You can bikeshed the spelling of those predicates, but it doesn't matter, they are just strings that you can see however you decide is best. On Mon, Oct 7, 2019, 8:38 PM Steven D'Aprano <steve@pearwood.info> wrote:
On Tue, Oct 08, 2019 at 09:19:07AM +1100, Cameron Simpson wrote:
On 07Oct2019 10:56, Joao S. O. Bueno <jsbueno@python.org.br> wrote:
So, in short, your idea is to allow "=" signs inside `[]` get notation to be translated to dicts on the call,
Subjectively that seems like a tiny tiny win. I'm quite -1 on this idea; language spec bloat to neglible gain.
As per Caleb's initial post, this is how Pandas currently does it:
db[db['x'] == 1]
Replacing that with db[x=1] seems like a HUGE win to me.
Even db[{'x': 1}] is pretty clunky.
-- Steven _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/RQH4VJ... Code of Conduct: http://python.org/psf/codeofconduct/