Skip to content

Commit ae8cc5c

Browse files
committed
docs: Add more notes on name.py
Stumbled into this when trying to inspect `pl.col("a").name.prefix("-1")`
1 parent f5e8d08 commit ae8cc5c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

narwhals/_plan/name.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010

1111

1212
class NameFunction(Function):
13-
"""`polars` version doesn't represent these as `FunctionExpr`.
13+
"""`polars` version [doesn't represent as `FunctionExpr`].
1414
15-
https://github.com/pola-rs/polars/blob/6df23a09a81c640c21788607611e09d9f43b1abc/crates/polars-plan/src/dsl/name.rs
15+
Also [doesn't support serialization].
16+
17+
[doesn't represent as `FunctionExpr`]: https://github.com/pola-rs/polars/blob/6df23a09a81c640c21788607611e09d9f43b1abc/crates/polars-plan/src/dsl/name.rs
18+
[doesn't support serialization]: https://github.com/pola-rs/polars/blob/dafd0a2d0e32b52bcfa4273bffdd6071a0d5977a/crates/polars-plan/src/dsl/expr_dyn_fn.rs#L145-L151
1619
"""
1720

1821
@property
@@ -34,16 +37,24 @@ def __repr__(self) -> str:
3437
return f"name.{m[tp]}"
3538

3639

37-
class Keep(NameFunction): ...
40+
class Keep(NameFunction):
41+
"""Returns ``Expr::KeepName``."""
3842

3943

4044
class Map(NameFunction):
45+
"""Returns ``Expr::RenameAlias``.
46+
47+
https://github.com/pola-rs/polars/blob/6df23a09a81c640c21788607611e09d9f43b1abc/crates/polars-plan/src/dsl/name.rs#L28-L38
48+
"""
49+
4150
__slots__ = ("function",)
4251

4352
function: AliasName
4453

4554

4655
class Prefix(NameFunction):
56+
"""Each of these depend on `Map`."""
57+
4758
__slots__ = ("prefix",)
4859

4960
prefix: str

0 commit comments

Comments
 (0)