Coder Social home page Coder Social logo

advance-python's Issues

你好,看了这个抽象基类的代码,想请教个问题

抽象基类总的来说和接口类似,是一个“不完整的”类,因为其内部可以有已经实现的方法,也有需要子类重新写的方法。但是我也可以定义一个父类,在父类中定义一个方法,但是只是定义,然后在方法中使用如下代码抛出异常,当子类中没有定义该方法的时候就会报错,提示子类中必须提供该方法,这种和抽象基类的应用是否存在冲突呢?或者说是都能实现,只是方式不同罢了?

raise NotImplementedError(
'subclasses of SiteBase must provide an find() method')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.