this post was submitted on 08 Dec 2023
624 points (96.6% liked)
Programmer Humor
32600 readers
53 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
In python: Not necessarily.
If you have an arg whose default is something you’re not supposed to bind as a default value in the function sig (e.g. the result of a function call), make it an
Optional
, default it toNone
, and then on the first line just dosome_arg = some_arg or interesting_function()