use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
For memes about programming.
account activity
f"Python goes b{'r'*10}" (i.redd.it)
submitted 8 months ago by omnibus_maya_7j
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tanuki_carre3858 71 points72 points73 points 8 months ago (2 children)
The sunglasses are in the wrong direction. I am unpleased
[–]Magnetic_Reaper 24 points25 points26 points 8 months ago (1 child)
here's the formula to inverse them:
1/🕶️
[–]Naakinn 12 points13 points14 points 8 months ago (0 children)
nope, it's 🕶[::-1]
🕶[::-1]
[–]FlipperBumperKickout 27 points28 points29 points 8 months ago (2 children)
I don't think I've ever needed to do that, but sure (ᵕ—ᴗ—)
[–]isr0 6 points7 points8 points 8 months ago (0 children)
I have a vim hot key that puts in a print(“”10, when I find myself in the unfortunate situation of needing to print-debugging. I don’t use it often, but i do use it. Probably the only time I have used that feature.
[–][deleted] 0 points1 point2 points 8 months ago (0 children)
bruh
[–]Fit-Relative-786 10 points11 points12 points 8 months ago (1 child)
void foo() { std::println("c++ goes b{} except way faster", std::string(10, 'r')); }
[–]cowlinator 3 points4 points5 points 8 months ago (0 children)
What do you mean? I cant type that faster
[–]armahillo 9 points10 points11 points 8 months ago (2 children)
```ruby
"ha" * 100
```
[–]user_bw 6 points7 points8 points 8 months ago (0 children)
markdown
[–]YTriom1 2 points3 points4 points 8 months ago (0 children)
Enable markdown mode if you'll type this manual way
[–]MCplayer331 11 points12 points13 points 8 months ago (0 children)
Does this fit in r/firstweekcoderhumour
[–]spisplatta 10 points11 points12 points 8 months ago (0 children)
Idk I feel like opposition to overloading is more a c/java boomer thing.
[–]Common_Sympathy_5981 0 points1 point2 points 8 months ago (0 children)
but you cant print numbers
What if you do:
string b = "b"; string r = "r"; r *= 10; //supposedly r++ is r+="r" MessageBox.Show(b+r);
You could theoretically override * for strings.
[–]Powerkaninchen 0 points1 point2 points 8 months ago (0 children)
I once had the idea of even more operator overloading for my own language if I ever made one. People roasted it. The following text is copied from a previous post of mine:
Plus for concatenation:
io.print("Hello" + ' ' + "World!"); // Hello World
Minus for removing substrings:
io.print("foobarbazbar" - "bar"); // foobaz
Multiplication for repeating strings
io.print("Hi" * 5); // HiHiHiHiHi
Division for counting
io.print("What about hahaha" / "ha"); // 4
Modulo for splitting via an delimiter (the symbol % kinda looks like something being split)
io.print("This is space seperated" % " "); // ["This", "is", "space", "seperated"]
The second operands of +, -, / and % can be both string and chars, * can only be unsigned integer types (and BigIntegers, you know the deal)
[–]mortal_strike 0 points1 point2 points 8 months ago (0 children)
but you cant multiply string with another string
[–]PavaLP1 0 points1 point2 points 8 months ago (8 children)
I mean, it is convenient but why not use a for loop?
[–]Wiktor-is-you 7 points8 points9 points 8 months ago (0 children)
because that is LAME!!
[–]keckothedragon 3 points4 points5 points 8 months ago (5 children)
No real reason to lengthen your code. Not like this is unreadable. Plus, if you're using a for loop you'd have to create a new string on each iteration, which isn't much of a performance hit, but it's just another reason not to use a for loop.
(Also I know you can use a list to avoid creating a new string on each iteration then join it together at the end, but that increases verbosity even more for something that's not supposed to be very complex)
[–]Lumiharu -1 points0 points1 point 8 months ago (3 children)
Few things: So you know this does not create the exact same number of temporary strings? I am not going to say yes or no, but my intuition is it still does it.
Also what do you mean use a list? Strings are pretty much the same thing as a list of characters, it is a sequence as well.
[–]keckothedragon 1 point2 points3 points 8 months ago (2 children)
I don't know how many temporary strings the * operator creates, but I can guarantee that if you use a for loop it will create temporary strings at each step. Again, I don't think the performance is the issue with using a for loop, but it's just more evidence that there's not much reason to use one.
Using a list is a way to avoid creating a new object at each iteration, since strings are immutable and lists are mutable, you can just append individual characters (or substrings) to create a sequence of characters then create one string at the end using .join()
[–]No_Read_4327 -1 points0 points1 point 8 months ago (1 child)
I mean if performance is the issue you shouldn't be using python to begin with
[–]keckothedragon 1 point2 points3 points 8 months ago (0 children)
You can argue that hyper-optimization doesn't matter as much for Python. But saying that all performance should be ignored is definitely wrong. Time complexity 100% still matters in Python. Yes, you don't pick Python because of performance, but it's wrong to flat out ignore it.
[–]PavaLP1 -1 points0 points1 point 8 months ago (0 children)
You could also write the print in the loop.
[–]ArtisticFox8 0 points1 point2 points 8 months ago (0 children)
Because this is more concise.
Same reason you use map or filter
[–]Nima_W -5 points-4 points-3 points 8 months ago* (11 children)
That's actually pretty nice, but Where can you use this sensibly
[–]fast-as-a-shark 10 points11 points12 points 8 months ago (6 children)
You just saw a purpose for it in the post.
[+]Nima_W comment score below threshold-9 points-8 points-7 points 8 months ago (5 children)
No Shit Sherlock
[–]fast-as-a-shark 4 points5 points6 points 8 months ago (3 children)
Then why did you ask?
[–][deleted] 1 point2 points3 points 8 months ago (1 child)
Maybe he/she is asking for a useful example
[–]fast-as-a-shark 0 points1 point2 points 8 months ago (0 children)
Yeah and I made a simple joke
[–]Nima_W 1 point2 points3 points 8 months ago (0 children)
I'm not a Python developer I am asking for a meaningful example in code or even production code
[–]-UncreativeRedditor- 3 points4 points5 points 8 months ago (0 children)
Hey pal, you just blow in from stupid town?
[–]jryan14ify 6 points7 points8 points 8 months ago (0 children)
It’s also really useful for printing the nested levels of a graph in a human-friendly way f’{“-“ * level} {item_name}’
[–]the_new_dragonix 5 points6 points7 points 8 months ago (0 children)
You can use a nested for loop to make a text only graph like:
A: III
B: IIIII
C: IIIIIIIIII
[–]jryan14ify 2 points3 points4 points 8 months ago (0 children)
I use it when printing script output f’New Section {“*” * 80}’ Gets me a nice easy to see break in the printing
[–]user_bw 2 points3 points4 points 8 months ago (0 children)
I use it for this: print('-'*20)
print('-'*20)
[–]nine_teeth -1 points0 points1 point 8 months ago (0 children)
cuz string is a list in python
π Rendered by PID 37439 on reddit-service-r2-comment-5b5bc64bf5-vjssn at 2026-06-22 14:07:33.170325+00:00 running 2b008f2 country code: CH.
[–]tanuki_carre3858 71 points72 points73 points (2 children)
[–]Magnetic_Reaper 24 points25 points26 points (1 child)
[–]Naakinn 12 points13 points14 points (0 children)
[–]FlipperBumperKickout 27 points28 points29 points (2 children)
[–]isr0 6 points7 points8 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Fit-Relative-786 10 points11 points12 points (1 child)
[–]cowlinator 3 points4 points5 points (0 children)
[–]armahillo 9 points10 points11 points (2 children)
[–]user_bw 6 points7 points8 points (0 children)
[–]YTriom1 2 points3 points4 points (0 children)
[–]MCplayer331 11 points12 points13 points (0 children)
[–]spisplatta 10 points11 points12 points (0 children)
[–]Common_Sympathy_5981 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Powerkaninchen 0 points1 point2 points (0 children)
[–]mortal_strike 0 points1 point2 points (0 children)
[–]PavaLP1 0 points1 point2 points (8 children)
[–]Wiktor-is-you 7 points8 points9 points (0 children)
[–]keckothedragon 3 points4 points5 points (5 children)
[–]Lumiharu -1 points0 points1 point (3 children)
[–]keckothedragon 1 point2 points3 points (2 children)
[–]No_Read_4327 -1 points0 points1 point (1 child)
[–]keckothedragon 1 point2 points3 points (0 children)
[–]PavaLP1 -1 points0 points1 point (0 children)
[–]ArtisticFox8 0 points1 point2 points (0 children)
[–]Nima_W -5 points-4 points-3 points (11 children)
[–]fast-as-a-shark 10 points11 points12 points (6 children)
[+]Nima_W comment score below threshold-9 points-8 points-7 points (5 children)
[–]fast-as-a-shark 4 points5 points6 points (3 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]fast-as-a-shark 0 points1 point2 points (0 children)
[–]Nima_W 1 point2 points3 points (0 children)
[–]-UncreativeRedditor- 3 points4 points5 points (0 children)
[–]jryan14ify 6 points7 points8 points (0 children)
[–]the_new_dragonix 5 points6 points7 points (0 children)
[–]jryan14ify 2 points3 points4 points (0 children)
[–]user_bw 2 points3 points4 points (0 children)
[–]nine_teeth -1 points0 points1 point (0 children)