Timeline for Various programming concepts (from a Python viewpoint)
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 21, 2012 at 14:19 | history | migrated | from stackoverflow.com (revisions) | ||
| Jan 21, 2012 at 10:56 | comment | added | Karl Knechtel | @FrancisAvila the abc module exists for handling abstract base classes a bit more elegantly, but I think most Pythonistas generally just don't bother setting them up at all - it's just that much needless busywork when you can just rely on duck typing. I know that's my feeling on the matter, anyway :) | |
| Jan 21, 2012 at 6:12 | comment | added | Luis | Thanks for the suggestions about interfaces and abstract classes. I actually recall that once I created one with the NotImplementedError. | |
| Jan 21, 2012 at 4:16 | comment | added | Francis Avila | BTW, an example of an "abstract class" in the Python standard library is asynchat.async_chat. | |
| Jan 21, 2012 at 4:11 | comment | added | Francis Avila | 2) Python doesn't have native language support for interfaces but are still useful enough for large projects that there are PEPs about them, and Zope created a userspace implementation (example) which is used by Twisted. | |
| Jan 21, 2012 at 4:10 | comment | added | Francis Avila | Good answer. I would add two things. 1) Abstract classes are emulated in Python by creating a class with methods which do nothing but raise NotImplementedError. Such classes can be instantiated but are useless in practice--they are provided as templates for subclasses. | |
| Jan 21, 2012 at 3:37 | history | answered | Luis | CC BY-SA 3.0 |