New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(python): Add syntactic sugar for col("foo")
-> col.foo
#10874
Conversation
f917b7d
to
05c6dea
Compare
Not quite; no need for the metaclass, and we can pacify the type-checkers without needing |
Done; modified the implementation and made the concise from polars import c, cs
c.colx
# col("colx")
cs.by_name("colx", "coly")
# cs.by_name('colx', 'coly') |
I am not really sure a about pre-determining the shortcuts for users. Especially single char c is something will collide a lot. I think we should just document our idiomatic important names. |
8abecd5
to
c8c1cdf
Compare
Thanks! I missed the idea of instantiating the object and exporting that instead. That makes it a lot cleaner indeed. I noticed the I'm also wondering what your intention is with naming the helper class I switched Now, to figure out how to make Sphinx happy 😅 Idiomatic usageWe should think about what we think idiomatic usage should look like here, and what we want to use in our own docs. |
Yup, makes sense -
Oh, nice - in my first iteration
Pure habit; anything I don't want the users instantiating themselves I generally name such that they can't claim they didn't know, haha. No objections to changing it to something else, though I'd still probably have "col" in an explicit
😎👍 |
I want to strongly push for keeping that. It is the most complete. It allows for all possible names in a DataFrame. For instance spaces and |
Great, then we're in agreement!
Yeah on second thought I agree - added it back! |
Yeah, considering this is not intended as a new idiomatic way of doing things, but rather for quick prototyping that's not intended for supporting every single use case, Meanwhile, I am down the rabbithole of getting things to look nice in Sphinx... 🙃 EDIT: Figured it out, just making things look nice now :) |
ebe1f25
to
348b235
Compare
348b235
to
0800bf6
Compare
World's smallest nitpick - rename |
That's true - renamed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks guys!
Closes #10866, closes #7398
Changes
col
as a factory object rather than a function. It supportscol.foo
as an alias forcol("foo")
.