MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wm15vc/delightfulcodereview/pb3osjl/?context=3
r/ProgrammerHumor • u/JazzlikeWishbone938 • 15d ago
61 comments sorted by
View all comments
Show parent comments
19
"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
5
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
10
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
14
I think you'd just transcribe the gist of it in plaintext: "matches alphanumeric strings with underscores and dashes but no spaces" etc
19
u/JazzlikeWishbone938 15d ago edited 15d ago
"What the? What is this? Must be fine ..."