Re: Need help understanding list structure

2016-05-03 Thread MRAB
On 2016-05-03 18:54, Dan Strohl via Python-list wrote: I added a __repr__ method at the end of the gedcom library like so: def __repr__(self): """ Format this element as its original string """ result = repr(self.level()) if self.pointer() != "": result +=

RE: Need help understanding list structure

2016-05-03 Thread Dan Strohl via Python-list
> I added a __repr__ method at the end of the gedcom library like so: > > def __repr__(self): > """ Format this element as its original string """ > result = repr(self.level()) > if self.pointer() != "": > result += ' ' + self.pointer() > result += ' '

Re: Need help understanding list structure

2016-05-03 Thread moa47401
I added a __repr__ method at the end of the gedcom library like so: def __repr__(self): """ Format this element as its original string """ result = repr(self.level()) if self.pointer() != "": result += ' ' + self.pointer() result += ' ' + self.tag()

RE: Need help understanding list structure

2016-05-03 Thread Dan Strohl via Python-list
Take a look at the docs for print() https://docs.python.org/3.5/library/functions.html#print str() https://docs.python.org/3.5/library/stdtypes.html#str repr() https://docs.python.org/3.5/library/functions.html#repr When you do "print(object)", python will run everything through str() and

Re: Need help understanding list structure

2016-05-03 Thread moa47401
At the risk of coming across as a complete dunder-head, I think my confusion has to do with the type of data the library returns in the list. Any kind of text or integer list I manually create, doesn't do this. See my questions down below at the end. If I run the following statements on the

Re: Need help understanding list structure

2016-05-03 Thread Chris Angelico
On Tue, May 3, 2016 at 11:21 PM, wrote: > Thanks for the replies. I definitely need a better understanding of " object at ADDRESS>" when using Python objects. So far no luck with web > searches or my Python books. Could someone point (no pun intended) me to a > good

Re: Need help understanding list structure

2016-05-03 Thread moa47401
Thanks for the replies. I definitely need a better understanding of "" when using Python objects. So far no luck with web searches or my Python books. Could someone point (no pun intended) me to a good resource? Not that it matters, but the reason I got off track is there are pointers within

Re: Need help understanding list structure

2016-05-02 Thread Ben Finney
moa47...@gmail.com writes: > Am I correct in assuming that parsing a large text file would be > quicker returning pointers instead of strings? What do you mean by “return a pointer”? Python doesn't have pointers. In the Python language, a container type (such as ‘set’, ‘list’, ‘dict’, etc.)

Re: Need help understanding list structure

2016-05-02 Thread Michael Torrie
On 05/02/2016 04:33 PM, moa47...@gmail.com wrote: > Yes, that does help. You're right. The author of the library I'm > using didn't implement either a __str__ or __repr__ method. Am I > correct in assuming that parsing a large text file would be quicker > returning pointers instead of strings?

Re: Need help understanding list structure

2016-05-02 Thread moa47401
> When Python's "print" statement/function is invoked, it will print the > textual representation of the object according to its class's __str__ or > __repr__ method. That is, the print function prints out whatever text > the class says it should. > > For classes which don't implement a __str__

Re: Need help understanding list structure

2016-05-02 Thread Erik
On 02/05/16 22:30, moa47...@gmail.com wrote: Can someone help me understand why or under what circumstances a list shows pointers instead of the text data? When Python's "print" statement/function is invoked, it will print the textual representation of the object according to its class's