this post was submitted on 12 Apr 2025
198 points (90.6% liked)

Technology

82855 readers
3406 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related news or articles.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] iAvicenna@lemmy.world 6 points 11 months ago (15 children)

well it does not imply directly per se since you can "not" many things but I feel like my first assumption would be it is used in a bool context

[–] thebestaquaman@lemmy.world 8 points 11 months ago (10 children)

I would say it depends heavily on the language. In Python, it's very common that different objects have some kind of Boolean interpretation, so assuming that an object is a bool because it is used in a Boolean context is a bit silly.

[–] iAvicenna@lemmy.world 4 points 11 months ago* (last edited 11 months ago) (8 children)

Well fair enough but I still like the fact that len makes the aim and the object more transparent on a quick look through the code which is what I am trying to get at. The supporting argument on bools wasn't't very to the point I agree.

That being said is there an application of "not" on other classes which cannot be replaced by some other more transparent operator (I confess I only know the bool and length context)? I would rather have transparently named operators rather than having to remember what "not" does on ten different types. I like duck typing as much as the next person, but when it is so opaque (name-wise) as in the case of "not", I prefer alternatives.

For instance having open or read on different objects which does really read or open some data vs not some object god knows what it does I should memorise each case.

load more comments (6 replies)
load more comments (7 replies)
load more comments (11 replies)