Re: [Tutor] creating a subclass from superclass without __init__

2012-08-24 Thread eryksun
On Fri, Aug 24, 2012 at 4:03 PM, Matt Gregory wrote: > > There are two classes of interest in GDAL - a Dataset which typically > describes a geospatial raster file and Band which described a single band > from the Dataset. gdal.Band just raises an AttributeError within __init__, > but a gdal.Band

Re: [Tutor] creating a subclass from superclass without __init__

2012-08-24 Thread Steven D'Aprano
On 25/08/12 06:03, Matt Gregory wrote: There are two classes of interest in GDAL - a Dataset which typically describes a geospatial raster file and Band which described a single band from the Dataset. gdal.Band just raises an AttributeError within __init__, but a gdal.Band instance can be creat

Re: [Tutor] creating a subclass from superclass without __init__

2012-08-24 Thread Matt Gregory
On 8/24/2012 12:01 PM, Steven D'Aprano wrote: That's not a use-case. A use-case is a real-world problem that you are trying to solve. You have skipped the problem and jumped straight to what you think is the solution: "create a subclass which can't be instantiated directly". I can't imagine any

Re: [Tutor] creating a subclass from superclass without __init__

2012-08-24 Thread Steven D'Aprano
On 25/08/12 04:22, Matt Gregory wrote: Is it possible to create a subclass of a superclass that doesn't have an __init__ and is only created through another class. Here is an example of what isn't working: class Spam(object): def __new__(cls, *args): return super(Spam, cls).__new__(c