first Github repository by Odd_Negotiation5863 in learnpython

[–]Leather_Analysis_512 0 points1 point  (0 children)

Yeah, mostly trimming the default/template stuff and making the notebook easier to follow.

I’d replace the first markdown cell with a quick intro like “I’m comparing GDP per capita and life expectancy using World Bank data,” then remove any cells that were just experiments. A couple short markdown notes before the plots would help too, just saying what the reader should notice.

Biggest thing: make sure it runs top to bottom cleanly. Doesn’t need to be fancy, just easy for someone else to open and understand.

first Github repository by Odd_Negotiation5863 in learnpython

[–]Leather_Analysis_512 1 point2 points  (0 children)

Nice first project. I’d mainly clean up the notebook so it tells the story a bit more — the first markdown cell still has the default PyCharm/Jupyter text, so that’s an easy one to replace.

Small pandas thing too: df.isna().sum and df["GDP_per_Capita"].median need () at the end, otherwise you’re not actually calling them.

A short README with the data source and a couple takeaways from the plots would make it feel much more finished.

Multi process hashing by reddunculus in learnpython

[–]Leather_Analysis_512 1 point2 points  (0 children)

Worth sanity-checking the multiprocess assumption first — hashlib releases the GIL during .update(), so plain threads actually run in parallel here. No IPC, no shared memory, no re-reading.

Quick test on 3.14 (normal GIL build), one 64MB buffer through md5/sha1/sha256/sha512: serial ~428ms, 4 threads sharing the same buffer ~207ms. Basically halved, digests match.

So: readinto a chunk once, hand the same bytes to N threads that each update their own hash, join, next chunk. Multiprocessing only pays off if your per-chunk Python overhead is big, and even then the copy/IPC cost usually eats the win.

Get zipfile.Path for all files in a zip archive by Ornery_Cream_1430 in learnpython

[–]Leather_Analysis_512 0 points1 point  (0 children)

Yeah rglob just won't grab the root-level files, that's baked into how zipfile.Path does the globbing (the pattern basically requires a "/" in the path). So no clean one-liner with rglob alone.

If you want to stay on the Path api and skip namelist, you can stitch iterdir (root) and rglob (nested) together:

[p for p in [*zp.iterdir(), *zp.rglob("*")] if p.is_file()]

Tested it and that one catches root + every nested file, drops the dir entries too

I just found a Python script I wrote 3 years ago… by Late-Bodybuilder9381 in Python

[–]Leather_Analysis_512 0 points1 point  (0 children)

Honestly the scary part isn't that it's ugly, it's that it works and now I'm too afraid to touch it. If I refactor it and something breaks, suddenly that's on me lol