Re: [Tutor] calling setters of superclasses

2010-12-22 Thread Matt Gregory
On 12/18/2010 2:06 AM, Peter Otten wrote: I don't think /how/ you are trying it is stupid though I'm not so sure about /what/ . Thank you all for very helpful suggestions. It took me a while to chew on this before I could respond. I learned a lot about descriptors and their interactions wit

[Tutor] classes for setting 2D envelopes

2010-12-22 Thread Matt Gregory
Hi all, I've been working on creating 2D bounding box (envelope) classes to describe spatial data. Variations of these are available in other spatial libraries (e.g. Shapely), although I haven't found envelopes specific to raster data that also specifies cell size. Could be I just haven't fo

Re: [Tutor] Need help with arrays

2011-05-05 Thread Matt Gregory
On 5/4/2011 10:30 AM, Patrick P. wrote: Hello, I hope this is the right way to ask my question, if not, sorry to bother you. Maybe you can tell me who to ask. Ok so here is my code [snip] A = np.array([[m111,m121], [m211,m221]]) B = np.array([[m112,m122], [m212,m222]]) print(np.dot(A,B)) Trac

Re: [Tutor] overriding instance attributes with keywords

2012-08-14 Thread Matt Gregory
On 8/14/2012 5:28 AM, eryksun wrote: On Tue, Aug 14, 2012 at 6:01 AM, eryksun wrote: Right, I overlooked classes with __slots__ and that override __new__ and other special methods. copy() is the better and more customizable solution. If copying is good enough, then this should work: from co

[Tutor] creating a subclass from superclass without __init__

2012-08-24 Thread Matt Gregory
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__(cls, args) def __init__(self):

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