Re: [Tutor] memory error

2015-06-30 Thread Danny Yoo
Hi Joshua, The issue you're encountering sounds like XML namespace issues. >> So I tried that code snippet you pointed me too and I'm not getting any >> output. This is probably because the tag names of the XML are being prefixed with namespaces. This would make the original test for node.

[Tutor] Inheritance, superclass, ‘super’ (was: __repr__ and __str__)

2015-06-30 Thread Ben Finney
Alan Gauld writes: > Whilst I agree with the general use of super I'm not sure what > the MRO resolution has to do with this case? When accessing the superclass, the MRO is always relevant. > It's explicitly single inheritance and they are explicitly calling the > superclass. They don't know t

Re: [Tutor] memory error

2015-06-30 Thread Danny Yoo
Please use reply to all: I'm currently not in front of a keyboard at the moment. Others on the mailing list should be able to help. On Jun 30, 2015 6:13 PM, "Joshua Valdez" wrote: > Hi Danny, > > So I tried that code snippet you pointed me too and I'm not getting any > output. > > I tried playin

Re: [Tutor] memory error

2015-06-30 Thread Alan Gauld
On 30/06/15 16:10, Joshua Valdez wrote: So I wrote this script to go over a large wiki XML dump and pull out the pages I want. However, every time I run it the kernel displays 'Killed' I'm assuming this is a memory issue after reading around but I'm not sure where the memory problem is in my scri

Re: [Tutor] __repr__ and __str__

2015-06-30 Thread Alan Gauld
On 30/06/15 21:38, Ben Finney wrote: def __str__(self): return """Here are your data: %s """ % list.__str__(self) Python allows any class to participate in multiple inheritance, and that's not determined at the point of writing your class. So you can never assume you kn

Re: [Tutor] memory error

2015-06-30 Thread Danny Yoo
On Tue, Jun 30, 2015 at 8:10 AM, Joshua Valdez wrote: > So I wrote this script to go over a large wiki XML dump and pull out the > pages I want. However, every time I run it the kernel displays 'Killed' I'm > assuming this is a memory issue after reading around but I'm not sure where > the memory

Re: [Tutor] __repr__ and __str__

2015-06-30 Thread Ben Finney
"Marilyn Davis" writes: > Hello Python Tutors, > > A student has asked a question that has me stumped. We are using 2.7. > > Looking at this code: > > #!/usr/bin/python > > class MyList(list): > > def __str__(self): > return """Here are your data: > %s > """ % list.__str__(se

Re: [Tutor] __repr__ and __str__

2015-06-30 Thread Marilyn Davis
Thank you so much Alan and Steve. We are good now. Marilyn On Tue, June 30, 2015 6:10 am, Steven D'Aprano wrote: > On Mon, Jun 29, 2015 at 11:47:45PM -0700, Marilyn Davis wrote: > >> Hello Python Tutors, >> >> >> A student has asked a question that has me stumped. We are using 2.7. >> > > Ooh

[Tutor] memory error

2015-06-30 Thread Joshua Valdez
So I wrote this script to go over a large wiki XML dump and pull out the pages I want. However, every time I run it the kernel displays 'Killed' I'm assuming this is a memory issue after reading around but I'm not sure where the memory problem is in my script and if there were any tricks to reduce

Re: [Tutor] __repr__ and __str__

2015-06-30 Thread Steven D'Aprano
On Mon, Jun 29, 2015 at 11:47:45PM -0700, Marilyn Davis wrote: > Hello Python Tutors, > > A student has asked a question that has me stumped. We are using 2.7. Ooh, nice one! That had me stumped for a while too, but I think I have the solution. I wrote this class to investigate: class MyList(l

Re: [Tutor] GUI program

2015-06-30 Thread Alan Gauld
On 30/06/15 06:02, Stephanie Quiles wrote: Hello, i am attempting to create a GUI program using Python 3.4. please see the pasted code below. > Why is nothing showing up? Because you have defined the GUI inside a class. But you never instantiate that class so the code never gets executed. Ho

Re: [Tutor] __repr__ and __str__

2015-06-30 Thread Alan Gauld
On 30/06/15 07:47, Marilyn Davis wrote: class MyList(list): def __str__(self): return """Here are your data: %s """ % list.__str__(self) def main(): a = MyList([1,2]) print a But if we add the special method: def __repr__(self): return "MyList

[Tutor] GUI program

2015-06-30 Thread Stephanie Quiles
Hello, i am attempting to create a GUI program using Python 3.4. please see the pasted code below. Why is nothing showing up? i am using Pycharm to run the program to see what it does and it says there are no errors but it does not show me an output. please let me know where i am falling short o

[Tutor] __repr__ and __str__

2015-06-30 Thread Marilyn Davis
Hello Python Tutors, A student has asked a question that has me stumped. We are using 2.7. Looking at this code: #!/usr/bin/python class MyList(list): def __str__(self): return """Here are your data: %s """ % list.__str__(self) def main(): a = MyList([1,2]) print