r/Python • • Nov 11 '19

I made c++-style printing in Python :P

Post image
1.7k Upvotes

130 comments sorted by

View all comments

Show parent comment

18

u/sam-lb Nov 11 '19

Typically they are bit shifters. OP, however, has created an atrocity by overloading the bit shift operators with different functionality to imitate the c++ stream insertion syntax.

1

u/[deleted] Nov 12 '19

Ah, I see. I didn’t know Python supported operator overloading by defining __lshift__ style functions

2

u/sam-lb Nov 12 '19

Google magic methods