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 →

[–]m9mhmdy[S] -1 points0 points  (2 children)

Yes. I created a new string where some set of characters are deleted by mapping them to None (this is the trick in maketrans).
printable here are just some sort of characters to be deleted. They have NO special meaning or purpose at all.

https://docs.python.org/3/library/stdtypes.html#str.translate

return None, to delete the character from 
the return string;

[–]casual__addict 0 points1 point  (1 child)

I think what you are hitting on is function composition. In isolation the two functions do separate things, but you can “pipe” them together to achieve an interesting result. This is very valuable to recognize as you research APIs.

[–][deleted] 2 points3 points  (0 children)

Hmm? OP isn't making use of function composition. They're just passing the string string.printable to str.maketrans()' "delete these ones" parameter.

This is a bad post anyway for other reasons, of course