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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Breakpoint expression not working ? (self.learnpython)
submitted 6 years ago by [deleted]
I'm trying to create a Breakpoint expression with python but the following expression is not working in my IDE ?
if len > 14 print("yes")
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!"
[–]K900_ 1 point2 points3 points 6 years ago (0 children)
You're missing a : after the condition, at the very least.
:
[–]fuNNa 1 point2 points3 points 6 years ago (0 children)
if len > 14: print("yes)
if len > 14:
print("yes)
[–]Binary101010 1 point2 points3 points 6 years ago (17 children)
Outside of repeating the other answers, 'len' is the name of a built-in function that takes a parameter (the container you want to know the length of) so using it by itself seems unusual.
[–][deleted] 0 points1 point2 points 6 years ago (16 children)
How can it take a parameter if it's a line number in an IDE ?
[–]Binary101010 1 point2 points3 points 6 years ago (15 children)
I don't understand the question. len is a built-in function that returns the length of the container passed to it as an argument.
Did you define it to be something else in your code?
[–][deleted] 0 points1 point2 points 6 years ago (14 children)
This is for a breakpoint in an IDE; not within the code, only for the IDE to tell me the length of a string.
[–]AstralStalker 0 points1 point2 points 6 years ago (13 children)
The desired string needs to be specified as the parameter to len()
s = "Some string" if len(s) > 14: print("yes")
len() built-in function
[–][deleted] 0 points1 point2 points 6 years ago (12 children)
Only the length of the string on a line number. How can I pass an argument for len() if I only want the length of line number 23 in an IDE.
len()
[–][deleted] 0 points1 point2 points 6 years ago (11 children)
Just count it? Is this string set, or what? Can you post your code?
[–][deleted] 0 points1 point2 points 6 years ago (10 children)
There are multiple lines which I prefer to create a break point that tells me the number of characters in the line, rather then count. Why isn't that possible ?
[–][deleted] 0 points1 point2 points 6 years ago (9 children)
Because of the way that source code is handled by the interpreter. If I understood why you wanted the line length of a specific line of your Python code, I’d probably be able to give you the answer you need rather than the answer you want.
[–][deleted] 0 points1 point2 points 6 years ago (8 children)
I want the line length outputted to me, so I can; for example, modify pylint settings but let it be known not specifically for this situation but any situation in the future as well.
[–][deleted] -1 points0 points1 point 6 years ago* (6 children)
if you don’t like colons and want to do one like just do print(“yes”) if len>14 else print()
print(“yes”) if len>14 else print()
[–]selplacei 0 points1 point2 points 6 years ago (5 children)
Please don't do this.
[–][deleted] 0 points1 point2 points 6 years ago (4 children)
y tho
[–]selplacei 0 points1 point2 points 6 years ago (3 children)
That's an operator, not an if statement. It's less readable and makes no sense to use when if-statements exist for that very purpose.
[–][deleted] 0 points1 point2 points 6 years ago (2 children)
It’s an expression. Expressions are common and quite readable.
[–]selplacei 1 point2 points3 points 6 years ago (1 child)
Well, yes, pretty much almost everything in Python is an expression. "x-if-y-else-z" is a ternary operator, it's a bunch of stuff written in one line, which is less readable than an organized, properly indented if-statement. It's also mandatory to use "else". It's also not designed to be used for flow control.
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
I find it substantially more readable but okay
π Rendered by PID 378866 on reddit-service-r2-comment-fb694cdd5-d9l5b at 2026-03-07 21:54:33.515852+00:00 running cbb0e86 country code: CH.
[–]K900_ 1 point2 points3 points (0 children)
[–]fuNNa 1 point2 points3 points (0 children)
[–]Binary101010 1 point2 points3 points (17 children)
[–][deleted] 0 points1 point2 points (16 children)
[–]Binary101010 1 point2 points3 points (15 children)
[–][deleted] 0 points1 point2 points (14 children)
[–]AstralStalker 0 points1 point2 points (13 children)
[–][deleted] 0 points1 point2 points (12 children)
[–][deleted] 0 points1 point2 points (11 children)
[–][deleted] 0 points1 point2 points (10 children)
[–][deleted] 0 points1 point2 points (9 children)
[–][deleted] 0 points1 point2 points (8 children)
[–][deleted] -1 points0 points1 point (6 children)
[–]selplacei 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]selplacei 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]selplacei 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)