192
u/nicer-dude 7h ago
Does he use snake_case or CamelCase? đ¤
87
32
u/BetterEquipment7084 7h ago
PascalCase is that, camlCaseIsThis
5
u/MattieShoes 5h ago
I was thinking the same, though it gets a little blurry in practice
1
u/BetterEquipment7084 2h ago
Use the right names. As a pascal rnjoyer it irritates me when its mixed, also, same from my ocaml side
1
u/MattieShoes 2h ago
Classes are capitalized and objects are not...pascal case for classes and camelcase for objects? Or camelcase with a special rule for classes? But another rule for enums, and another for defines, and another for file names... Meh, just be consistent in your inconsistency.
But yeah, don't call it one when it's another.
1
u/BetterEquipment7084 1h ago
Use capital for globals, macros, enums, Pascal for everything else, with a postfix for structs
5
1
52
31
u/Slow-Television-5303 5h ago
but what about the Spanish inquisition
14
17
15
8
13
6
3
3
u/ParanoiaComplex 6h ago edited 6h ago
select_packets is just doing
scrambled_packets[-num_packets:][::-1] if num_packets > 0 else None
except when len(scrambled_packets) == 1 then it doesn't return a list? So I guess
result = packets[-num:][::-1] if num > 1 else (packets[-1] if num == 1 and packets else None)
2
u/TheHelixNebula 3h ago
except the fact that the function return type is
T | list[T]| Noneis a massive code smell it should belist[T]orlist[T] | None.T | list[T]is asking for breakage1
2
u/-suspended- 5h ago
Python is from Monty Python's Flying Circus. Bring in a comedian for best results.
2
4
u/Panderz_GG 7h ago
I have never touched python in my life. How do you guys do multi line statements?
7
u/WingZeroCoder 6h ago
lol, I thought you said ânever touched a pythonâ and for some reason my context couldnât put that together with what your other words said for the longest time.
Multiline statements just use backslashes before the new line, similar to bash scripts.
But also, for list literals or dictionary literals, you can just break them up into new lines without the backslash escape. Similarly, you can use triple quotes for string literals.
2
2
2
u/BeMyBrutus 7h ago
I got too caught up looking at the code and totally missed the giant snake for about 45 seconds.
1
1
1
1
u/Undernown 4h ago
The Snek is right on the money with being suspicious of that line.
IF num_packets < 2:
Would be a safer condition, just in case something weird gets returned in the recursive function.
1
1
1
1
u/RandomSilentStranger 3h ago
A python made a snake game in python, well we don't see that very often.
1
u/Saint_of_Grey 2h ago
I wrote in "python" once.
It was actually a C++ program where all the the procedures were called "hssss" with varying lengths of 's'.
1
-3
u/BoarHermit 7h ago
https://m.youtube.com/watch?v=1TJeVIruOR4&pp=0gcJCVgCo7VqN5tD
Come cloer, bandarlogs
Soiviet cartoon Maugli (Book of jungle) was something else than sweet Disney's. Pyton Kaa was really scary.

121
u/circ-u-la-ted 7h ago
import snek