• 0 Posts
  • 252 Comments
Joined 2 years 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.socialtoProgrammer Humor@lemmy.mlAI's take on XML
    link
    fedilink
    English
    arrow-up
    184
    arrow-down
    1
    ·
    7 months ago

    Some data formats are easy for humans to read but difficult for computers to efficiently parse. Others, like packed binary data, are dead simple for computers to parse but borderline impossible for a human to read.

    XML bucks this trend and bravely proves that data formats do not have to be one or the other by somehow managing to be bad at both.