• 0 Posts
  • 271 Comments
Joined 1 year ago
cake
Cake day: September 13th, 2023

help-circle
  • Because to a certain extent Python is duck typed. Python has no concept of interfaces, unless you count the abc module combined with manual isinstance() checks, which I’ve never seen anyone do in production. In order to be passed to some function that expects a “file-like object”, it just has to have methods named read(), seek(), and possibly isatty(). The Python philosophy, at least as I see it, is “as long as it has methods named walk() and quack(), it’s close enough to a duck for me to treat it as one”.

    Duck typing is distinct from weak type systems, though.













  • AVincentInSpace@pawb.socialtoFuck AI@lemmy.worldOops
    link
    fedilink
    English
    arrow-up
    17
    arrow-down
    1
    ·
    4 months ago

    Bold of you to assume this will actually stop anything.

    It’s like the Nigerian prince scam emails with inentionally bad grammar. They don’t want to waste their time with people who don’t fall for obvious scams, so they craft their email so that anyone with half a brain will reject it. And they still get millions of responses.