This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Kevin Shweh
Recipients Kevin Shweh, docs@python
Date 2017-08-06.19:00:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502046042.43.0.230510870536.issue31127@psf.upfronthosting.co.za>
In-reply-to
Content
The only check that prevents instantiating abstract classes is in object.__new__, but most built-in classes never actually call object.__new__. That means you can do stuff like

import abc

class Foo(list, metaclass=abc.ABCMeta):
	@abc.abstractmethod
	def abstract(self):
		pass

Foo()

and the Foo() call will silently succeed.

Ideally, the Foo() call should fail. Other options include having the Foo class definition itself fail, or just making a note in the documentation describing the limitation. (As far as I can see, this is currently undocumented.)
History
Date User Action Args
2017-08-06 19:00:42Kevin Shwehsetrecipients: + Kevin Shweh, docs@python
2017-08-06 19:00:42Kevin Shwehsetmessageid: <1502046042.43.0.230510870536.issue31127@psf.upfronthosting.co.za>
2017-08-06 19:00:42Kevin Shwehlinkissue31127 messages
2017-08-06 19:00:42Kevin Shwehcreate