this post was submitted on 13 Jul 2023
10 points (100.0% liked)

Python

6288 readers
8 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

๐Ÿ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

๐Ÿ Python project:
๐Ÿ’“ Python Community:
โœจ Python Ecosystem:
๐ŸŒŒ Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

Long time coder here with a STEM degree, but not a CS degree. I've mostly used programming as a tool to help me with my job rather than as my job, so I'm conscious that I have some gaps in my programming skillset.

To close a couple of those gaps, I'm trying become competent at Github and take my Python skills to the next level.

If you kind people could provide suggestions on improvements I could make to this repo and the code in it I'd be ever so grateful. :)

It's a bot to run Lemmy posts and comments through the pretrained Detoxify transformer model and to report toxic comments for the Mods to action.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] oscar 1 points 1 year ago* (last edited 1 year ago) (1 children)

I haven't gone though it in detail but something that stood out to me is the complexity of process_content().

If you at some point end up with a large function, or if you have deeply nested blocks, it can help readability to split it up into smaller functions with more clear goals, even if they are only called once. In your case you could keep process_content() as a sort of parent function for calling smaller ones.

I'm guilty of large functions too because it's easier to just add stuff to a single function while developing and debugging, but before I submit stuff I tend to go through and clean up by doing this.

Though I guess this is sort of opinionated too!

[โ€“] [email protected] 2 points 1 year ago

Good point and thank you. My functions do tend to evolve into unwieldy messes.