Re: Help creating new module which inherits existing class from another module.

2014-02-19 Thread Jonno
> > > > The idea is that when you have a NewClass instance, calling > "newobject.foo" will automatically call the descriptor's __getmethod__, > passing it the class and instance. That descriptor will create and > populate the FooClass instance, which does the real work. > > Descriptors are how meth

Re: Help creating new module which inherits existing class from another module.

2014-02-19 Thread Jonno
On Tue, Feb 18, 2014 at 11:48 PM, Ben Finney wrote: > Jonno writes: > > > I tried to explain the necessary properties in the requirements below. > > What you've described is a bunch of abstract behaviour. > > But as I said, I'm suspecting this is a poor desig

Re: Help creating new module which inherits existing class from another module.

2014-02-18 Thread Jonno
Ben, Thanks for your reply. I'll try to ellaborate a little more in the comments below. On Tue, Feb 18, 2014 at 2:47 PM, Ben Finney wrote: > Jonno writes: > > > I'm not sure if this list is a suitable place to ask for this kind of > > help so if it's not

Help creating new module which inherits existing class from another module.

2014-02-18 Thread Jonno
I'm not sure if this list is a suitable place to ask for this kind of help so if it's not please just suggest another forum which might be more suitable. I'm looking for help/suggestions how to architect a module (perhaps just a class). There is an existing module I want to use which has a class

Re: Making sense of a traceback from py2exe

2012-08-30 Thread Jonno
On Thu, Aug 30, 2012 at 4:02 PM, Jonno wrote: > > Well I managed to figure out that the first traceback is the one causing > the problem and that matplotlib/mathtext in my app is the problem. > Now to figure out how to get mathtext working. > Bit more information: I am also see

Re: Making sense of a traceback from py2exe

2012-08-30 Thread Jonno
On Thu, Aug 30, 2012 at 3:11 PM, Jonno wrote: > Not sure where the best place to post this is. My app uses wxpython, > matplotlib. > I'm running Python 2.7 on Windows 7. > I have a script app.py that I'm trying to turn into app.exe using py2exe. > The exe runs fine on th

Making sense of a traceback from py2exe

2012-08-30 Thread Jonno
Not sure where the best place to post this is. My app uses wxpython, matplotlib. I'm running Python 2.7 on Windows 7. I have a script app.py that I'm trying to turn into app.exe using py2exe. The exe runs fine on the pc that it was compiled on but on another Win7 machine I get something like the fo

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 4:57 PM, Ian Kelly wrote: > > By the way, looking at your object hierarchy more closely, isn't > "app.frame.graph_panel" going to end up being the same thing as just > "self.figure"? Why not just use the latter and remove the reliance on > finding the correct frame? > I

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 4:20 PM, Ian Kelly wrote: > > The App object is created and the wx framework already knows about it. > It's just not assigned to the app global yet, and the OnInit call has > not completed yet. See: > > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit > (I

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly wrote: > > Exactly. The line "app = MyApp(0)" creates a MyApp instance and then > assigns it to "app". As part of the MyApp creation process, it > creates a MyFrame, which creates a Tab, which creates a Class1, which > attempts to reference "app". All

Re: Using an object inside a class

2012-01-23 Thread Jonno
elf.frame.Show(True) return True app = MyApp(0) app.MainLoop() On Mon, Jan 23, 2012 at 3:22 PM, Jonno wrote: > > > On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy wrote: > >> On 1/23/2012 2:44 PM, Jonno wrote: >> >>> I have a pretty complicated bit of code that

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy wrote: > On 1/23/2012 2:44 PM, Jonno wrote: > >> I have a pretty complicated bit of code that I'm trying to convert to >> more clean OOP. >> >> Without getting too heavy into the details I have an object which I am

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 2:09 PM, Ian Kelly wrote: > On Mon, Jan 23, 2012 at 12:44 PM, Jonno wrote: > > I have a pretty complicated bit of code that I'm trying to convert to > more > > clean OOP. > > Then you probably should not be using globals. > I'm try

Re: Using an object inside a class

2012-01-23 Thread Jonno
On Mon, Jan 23, 2012 at 1:44 PM, Jonno wrote: > I have a pretty complicated bit of code that I'm trying to convert to more > clean OOP. > > Without getting too heavy into the details I have an object which I am > trying to make available inside another class. The referenc

Using an object inside a class

2012-01-23 Thread Jonno
I have a pretty complicated bit of code that I'm trying to convert to more clean OOP. Without getting too heavy into the details I have an object which I am trying to make available inside another class. The reference to the object is rather long and convoluted but what I find is that within my cl

split string but ignore sep inside double quotes

2011-04-13 Thread Jonno
All, I have the following unicode object: u'3,"Some, text",more text' and I want to split it into a list like this: [3,"Some, text", more text] In other words I want to split on the comma but not if it's inside a double-quote. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Slice a list of lists?

2010-09-09 Thread Jonno
On Thu, Sep 9, 2010 at 10:58 AM, Robert Kern wrote: > Please keep responses on the mailing list. However, I will reply below > this one time. > > On Thu, Sep 9, 2010 at 10:35, Jonno wrote: >> On Wed, Sep 8, 2010 at 4:26 PM, Robert Kern wrote: >>> A motivating example:

Re: Slice a list of lists?

2010-09-08 Thread Jonno
On Wed, Sep 8, 2010 at 3:44 PM, Andreas Waldenburger wrote: > On Wed, 8 Sep 2010 15:23:35 -0500 Jonno wrote: > >> On Wed, Sep 8, 2010 at 3:18 PM, Jonno wrote: >> [snip] >> > Now if I want to select the first item in every 2nd item of list a >> > (ie: [1,7])

Re: Slice a list of lists?

2010-09-08 Thread Jonno
On Wed, Sep 8, 2010 at 3:18 PM, Jonno wrote: > On Wed, Sep 8, 2010 at 3:06 PM, Jonno wrote: >> On Wed, Sep 8, 2010 at 2:11 PM, Benjamin Kaplan >> wrote: >>> On Wed, Sep 8, 2010 at 2:55 PM, Jonno wrote: >>>> I know that I can index into a list of lists like

Re: Slice a list of lists?

2010-09-08 Thread Jonno
On Wed, Sep 8, 2010 at 3:06 PM, Jonno wrote: > On Wed, Sep 8, 2010 at 2:11 PM, Benjamin Kaplan > wrote: >> On Wed, Sep 8, 2010 at 2:55 PM, Jonno wrote: >>> I know that I can index into a list of lists like this: >>> a=[[1,2,3],[4,5,6],[7,8,9]] >>> a[0][2]

Re: Slice a list of lists?

2010-09-08 Thread Jonno
On Wed, Sep 8, 2010 at 2:11 PM, Benjamin Kaplan wrote: > On Wed, Sep 8, 2010 at 2:55 PM, Jonno wrote: >> I know that I can index into a list of lists like this: >> a=[[1,2,3],[4,5,6],[7,8,9]] >> a[0][2]=3 >> a[2][0]=7 >> >> but when I try to use fancy in

Slice a list of lists?

2010-09-08 Thread Jonno
I know that I can index into a list of lists like this: a=[[1,2,3],[4,5,6],[7,8,9]] a[0][2]=3 a[2][0]=7 but when I try to use fancy indexing to select the first item in each list I get: a[0][:]=[1,2,3] a[:][0]=[1,2,3] Why is this and is there a way to select [1,4,7]? -- http://mail.python.org/ma

Combination of element-wise and matrix multiplication

2008-07-01 Thread Jonno
1,0] = e*g+f*i x[1,1] = e*h+f*j What is the simplest way to do this? I ended up doing the matrix multiplication manually as above but this doesn't scale very nicely if a & b become larger size. Cheers, Jonno. -- "If a theory can't produce hypotheses, can't be tested, ca

Re: Convert string to array of floats

2008-06-19 Thread Jonno
Brilliant! Thanks. On Thu, Jun 19, 2008 at 10:00 AM, Cédric Lucantis <[EMAIL PROTECTED]> wrote: > Le Thursday 19 June 2008 17:12:08 Jonno, vous avez écrit : > > Hi, > > > > I'm very new to programming and python. > > > > I need to convert a st

Convert string to array of floats

2008-06-19 Thread Jonno
Hi, I'm very new to programming and python. I need to convert a string like this: ' 0.906366 2.276152 0.01336980.773141 0.002836 -107.335197 0.01146286.846290\n' to an array of floats. Any pointers to the simplest way of doing this? Thanks. -- "If a