Re: Can I make unicode in a repr() print readably?

2006-09-11 Thread Martin v. Löwis
Terry Hancock schrieb: > I don't know about the backwards compatibility issue. I'm not sure > what would be affected. But "print" frequently generates encoded > Unicode output if the stream supports it, so there is no guarantee > whether it produces unicode or string output now. I'm not worried a

Re: Can I make unicode in a repr() print readably?

2006-09-11 Thread Terry Hancock
Martin v. Löwis wrote: > Terry Hancock schrieb: > > Or, put another way, what exactly does 'print' do when it gets a > > class instance to print? It seems to do the right thing if given a > > unicode or string object, but I cant' figure out how to make it do > > the same thing for a class instance

Re: Can I make unicode in a repr() print readably?

2006-09-10 Thread Martin v. Löwis
Terry Hancock schrieb: > Is it possible to define some combination of __repr__, __str__, > and/or __unicode__ so that the unicode() wrapper isn't necessary > in this statement: I'm not aware of a way of doing so. > Or, put another way, what exactly does 'print' do when it gets > a class instance

Can I make unicode in a repr() print readably?

2006-09-09 Thread Terry Hancock
I still run into my own ignorance a lot with unicode in Python. Is it possible to define some combination of __repr__, __str__, and/or __unicode__ so that the unicode() wrapper isn't necessary in this statement: >>> print unicode(jp.concepts['adjectives']['BLUE'][0]) (i.e. can I make it so tha