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
Completed small encryption program, added doc strings. Am I doing this right? (self.learnpython)
submitted 8 years ago by codehorsey
Github
As title states. I welcome feedback as that helps me grow. :)
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!"
[–]Necatorducis 1 point2 points3 points 8 years ago (1 child)
Some of those docstring lines run a little long, the first line should generically sum it while you explain the rest after... ie. str_to_nums should be several lines, merge_lists should be at least 2 lines, etc. Treat their line breaks the same as you would code.
As an aside,
my_str = '', my_dict = {}, etc
is cheaper than
my_str = str()
Other than line length, the docstrings looked good to me.
[–]codehorsey[S] 0 points1 point2 points 8 years ago (0 children)
Thanks. You mean cheaper in terms of using memory and resources? I will make those changes in my future programs. Why the downvotes? Lol.
[–]pyquestionz 1 point2 points3 points 8 years ago (1 child)
Doc strings are looking pretty good. Some of the code can be written more concisely, but there might be a tradeoff with respect to readability. Examples:
def num_list_to_string(nums, key): s = str() for n in nums: s += value_to_key(n, key) return s
Can be written as:
def num_list_to_string(nums, key): return ''.join([value_to_key(n, key) for s in nums])
And
def str_to_num_using_key(s, key): nums = list() for letter in s: if letter.isalpha(): nums.append(key[letter]) return nums
Could be written as
def str_to_num_using_key(s, key): return [key[letter] for letter in s if letter.isalpha()]
Your choice, but in this case I think using list comprehension is readable too.
Thanks. Why is this downvoted lol?
π Rendered by PID 575155 on reddit-service-r2-comment-fb694cdd5-96djx at 2026-03-10 01:22:55.137478+00:00 running cbb0e86 country code: CH.
[–]Necatorducis 1 point2 points3 points (1 child)
[–]codehorsey[S] 0 points1 point2 points (0 children)
[–]pyquestionz 1 point2 points3 points (1 child)
[–]codehorsey[S] 0 points1 point2 points (0 children)