I write a lot of Python. I hate it when people use “X is more pythonic” as some kind of argument for what is a better solution to a problem. I also have a hang up with people acting like python has any form of type safety, instead of just embracing duck typing.This lands us at the following:
The article states that “you can check a list for emptiness in two ways: if not mylist
or if len(mylist) == 0
”. Already here, a fundamental mistake has been made: You don’t know (and shouldn’t care) whether mylist
is a list. These two checks are not different ways of doing the same thing, but two different checks altogether. The first checks whether the object is “falsey” and the second checks whether the object has a well defined length that is zero. These are two completely different checks, which often (but far from always) overlap. Embrace the duck type- type safe python is a myth.
Opisek@lemmy.world 9 hours ago
The graph makes no sense. Did a generative AI make it.
sugar_in_your_tea@sh.itjust.works 4 hours ago
I think there’s a good chance of that:
-2x
instead of~2x
- a human is unlikely to make that mistake==0
- there’s a space every other time it’s done, including the screenshotiknowitwheniseeit@lemmynsfw.com 7 hours ago
My ad blocker has blocked all pictures on this article, so I can’t say. 😄
nutsack@lemmy.dbzer0.com 3 hours ago
thanks I appreciate it