What's the Python version for “Code against an interface, not an object”?

后端 未结 4 2070
长情又很酷
长情又很酷 2021-01-30 06:45

Inspired by a great question (and bunch of great answers) from here.

Does the statement \"Code against an interface, not an object\" have any significance in Python?

4条回答
  •  春和景丽
    2021-01-30 07:25

    What's the Python version for “Code against an interface, not an object.”?

    The proper quote is "program against an interface, not an implementation". The principle holds the same way in Python that it did in Smalltalk, the language it in which it originated.

    Does the statement "Code against an interface, not an object." have any significance in Python?

    Yes. It has the same significance in Python as it has in the language that this quote originated from (Smalltalk), and in every other language.

提交回复
热议问题