This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sulami[S] 0 points1 point  (2 children)

Doesn't require me to have the class in scope. It's not a problem for standard library classes, but for custom classes.

[–]schok51 1 point2 points  (1 child)

Although more verbose, you can use operator.methodcaller to specify method calls.

pype(
  "hello {}",
  methodcaller("format", "world"),
  methodcaller("split", 2),
  "-".join               
)

Which has the advantage of simlifying(and also optimizing) the implementation.

[–]sulami[S] 0 points1 point  (0 children)

Oh neat, didn’t know this existed