Re: [Tutor] memory consumption

2013-07-03 Thread Steven D'Aprano
On 04/07/13 09:24, Oscar Benjamin wrote: On 3 July 2013 23:37, Andre' Walker-Loud wrote: Hi Oscar, Hi Andre', (your name shows in my email client with an apostrophe ' after it; I'm not sure if I'm supposed to include that when I write it). I expect that it's meant to be André, since that i

Re: [Tutor] memory consumption

2013-07-03 Thread Steven D'Aprano
On 04/07/13 08:11, Andre' Walker-Loud wrote: Yes, I was being sloppy. My later post clarified what I meant. The loops are really lists, and I was really using enumerate() to get both the iter and the element. loop_2 = [1,2,4,8,16,32,64,128,256,512,1024] for i,n in enumerate(loop_2): ...

Re: [Tutor] memory consumption

2013-07-03 Thread Alan Gauld
On 03/07/13 20:50, Andre' Walker-Loud wrote: # loop over parameters and fill array with desired output for i in range(loop_1): for j in range(loop_2): for k in range(loop_3): How big are loop_1, loop_2, loop_3? The sizes of the loops are not big len(loop_1) = 20 len(loop_2) = 1

Re: [Tutor] memory consumption

2013-07-03 Thread Alan Gauld
On 03/07/13 19:17, Andre' Walker-Loud wrote: Your terminology is all kixed up and therefore does not make sense. WE definitely need to know more about the my_class module and do_stuff # generic code skeleton # import a class I wrote to utiliz

Re: [Tutor] memory consumption

2013-07-03 Thread Dave Angel
On 07/03/2013 02:17 PM, Andre' Walker-Loud wrote: Hi All, I wrote some code that is running out of memory. And you know this how? What OS are you using, and specifically how is it telling you that you've run out of memory? And while you're at it, what version of Python? And are the OS and

Re: [Tutor] memory consumption

2013-07-03 Thread Steven D'Aprano
On 04/07/13 04:17, Andre' Walker-Loud wrote: Hi All, I wrote some code that is running out of memory. How do you know? What are the symptoms? Do you get an exception? Computer crashes? Something else? It involves a set of three nested loops, manipulating a data file (array) of dimension

Re: [Tutor] Memory consumption question

2007-11-16 Thread Tiger12506
> OK, the analogy is cute, but I really don't know what it means in > Python. Can you give an example? What are the parts of an old-style > class that have to be 'ordered' separately? How do you 'order' them > concisely with a new-style class? > > Thanks, > Kent He is setting up the analogy so tha

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
Sorry, sloppy cutting and pasting. Should be: Referring to the original post: > > > >>> dir(A) > > ['__doc__', '__module__'] > > >>> dir(B) > > ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', > > '__hash__', '__init__', '__module__', '__new__', '__reduce__', > > '__reduce_

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
Referring to the original post: > >>> dir(B) > ['__doc__', '__module__'] > >>> dir(B) > ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', > '__hash__', '__init__', '__module__', '__new__', '__reduce__', > '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__'] >

Re: [Tutor] Memory consumption question

2007-11-15 Thread Kent Johnson
OK, the analogy is cute, but I really don't know what it means in Python. Can you give an example? What are the parts of an old-style class that have to be 'ordered' separately? How do you 'order' them concisely with a new-style class? Thanks, Kent Marc Tompkins wrote: > I thought of an analog

Re: [Tutor] Memory consumption question

2007-11-15 Thread Eric Brunson
I'm sorry, but a Reuben with no 'kraut is just a corned beef sandwich. :-) Marc Tompkins wrote: > And here's another reason to use new-style: I forgot the sauerkraut! > Oh, the horror! > > On Nov 15, 2007 1:42 PM, Marc Tompkins <[EMAIL PROTECTED] > > wrote: > >

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
And here's another reason to use new-style: I forgot the sauerkraut! Oh, the horror! On Nov 15, 2007 1:42 PM, Marc Tompkins <[EMAIL PROTECTED]> wrote: > I thought of an analogy I like better than my sign-painting one: ordering > a sandwich. > Imagine: you're at the deli, and your waitron asks w

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
I thought of an analogy I like better than my sign-painting one: ordering a sandwich. Imagine: you're at the deli, and your waitron asks what you want. (Granted, this is a silly example.) "Classic" order: "I'd like a sandwich with two slices of rye bread, Russian dressing, corned beef, and Swiss

Re: [Tutor] Memory consumption question

2007-11-15 Thread Kent Johnson
Marc Tompkins wrote: > I didn't mean that exactly literally - for goodness' sake, this is a > high-level, object-oriented, interpreted language! We're not writing > machine language here. Yes, I was thinking I should re-word my email, it was worded a bit too strongly... > What I did mean, and

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
I didn't mean that exactly literally - for goodness' sake, this is a high-level, object-oriented, interpreted language! We're not writing machine language here. What I did mean, and will probably still not express as clearly as I'd like, is that when you create a "classic" class, lots of options

Re: [Tutor] Memory consumption question

2007-11-15 Thread Marc Tompkins
Thus spake Bart Cramer: > I have a question... : > > >>> class A: pass > ... > >>> class B(object) : pass > ... > >>> dir(A) > ['__doc__', '__module__'] > >>> dir(B) > ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', > '__hash__', '__init__', '__module__', '__new__', '__redu

Re: [Tutor] Memory consumption question

2007-11-15 Thread Kent Johnson
Marc Tompkins wrote: > class B is a "new-style' class, meaning that it inherits from a base, > pre-existing class (in this case "object", which is as basic and generic > as you can get!). class A has to start from nothing, which is why it > consumes more memory yet has less functionality. I d

[Tutor] Memory consumption question

2007-11-15 Thread Bart Cramer
Dear all, I have a question... : >>> class A: pass ... >>> class B(object) : pass ... >>> dir(A) ['__doc__', '__module__'] >>> dir(B) ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',