in reply to Re: Can I ask Perl if an object will stringify?
in thread Can I ask Perl if an object will stringify?

Tag Rolf

What is 'stolen from Python'? Do you mean the phrase "it's easier to ask for forgiveness than it is to ask for permission"?
That's a quotation from the great Rear-Admiral Grace Hopper.

Grace Hopper - Wikiquote
  • Comment on Re^2: Can I ask Perl if an object will stringify?

Replies are listed 'Best First'.
Re^3: Can I ask Perl if an object will stringify? (EAFP and Python)
by LanX (Saint) on Apr 01, 2015 at 10:02 UTC
    Moin Dumu,

    already admitted that Grace was earlier but ...

    EAFP is a very common coding style in Python, such that it became part of their glossary.

    Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many try and except statements. The technique contrasts with the LBYL style common to many other languages such as C.

    IMHO they rely on it much more than Perl hackers do. I'm often surprised how often try/catch constructs are used there to handle fuzzy situations.

    "Stolen" because we don't catch any exceptions in my suggestion.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    PS: Je suis Charlie!

      Thanks Rolf.

      I deliberately know very litte about Python apart from that it doesn't use semicola, so I miss out on what's good about it as well as everything else!
      Of course, Perl has plenty of programming philosophy, but I never imagined that Python did.
        Oh it has plenty, but I'm tempted to rather call it ideology. ;-)

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)

        PS: Je suis Charlie!

      Rolf...

      So you did!

      I think / trust / hope that Adm. Hopper would be pleased that her maxim has become an acronym and has been applied directly to the craft she did so much to advance. (I don't think she used it in that way).