RE: Use __repr__ to show the programmer's representation (was: Need help understanding list structure)

2016-05-03 Thread Dan Strohl via Python-list
> > One other point for you, if your "__repr__(self)" code is the same as > > the "__str__(self)" code (which it looks like it is, at a glance at > > least), you can instead reference the __str__ method and save having a > > duplicate code block... > > Alternatively, consider: the ‘__repr__’ metho

Re: Use __repr__ to show the programmer's representation (was: Need help understanding list structure)

2016-05-03 Thread moa47401
quote - (Though to be fair, I don't really know what the actual problem was, so I might provide a different approach with a different goal ) Originally I was trying to understand the exact structure of the list being returned by the gedcom library. It worked as it was, but I wanted to add addit

Re: Use __repr__ to show the programmer's representation (was: Need help understanding list structure)

2016-05-03 Thread Random832
On Tue, May 3, 2016, at 15:24, moa47...@gmail.com wrote: > I also wanted to understand what character set it was returning. I was > giving it a gedcom file with ansel encoding, which is normal. My > genealogy program can also export its database to gedcom using UTF-8 and > Unicode. But both of thos

Re: Use __repr__ to show the programmer's representation (was: Need help understanding list structure)

2016-05-03 Thread Chris Angelico
On Wed, May 4, 2016 at 4:35 AM, Dan Strohl via Python-list wrote: > I also have never actually used repr() to create code that could be fed back > to the interpreter (not saying it isn’t done, just that I haven’t run into > needing it), and there are so many of the libraries that do not return a