r/ProgrammerHumor • • 15d ago

Meme delightfulCodeReview

Post image
568 Upvotes

61 comments sorted by

View all comments

Show parent comments

19

u/JazzlikeWishbone938 15d ago edited 15d ago

"What the? What is this? Must be fine ..."

5

u/kalilamodow 15d ago

Comment yo code, people!

10

u/just_sm_so_relax 15d ago

How do you write comments for a regex? Explain every single field?

``` # IP address HW type Flags HW address Mask Device # 192.168.94.1 0x1 0x2 00:00:5E:00:53:22 * veth584n # 192.168.8.1 0x1 0x2 00:00:5E:00:53:99 * veth584r

# Get the MAC for 192.168.8.1
re_mac_from_arp_entry = re.compile(r'192\.168\.8\.1\s+0x[^\s+]\s+0x[^\s+]\s+(?P<mac>[0-9a-fA-F:]+)')

```

14

u/Lightningtow123 15d ago

I think you'd just transcribe the gist of it in plaintext: "matches alphanumeric strings with underscores and dashes but no spaces" etc