Steven D'Aprano wrote:
On Fri, 08 May 2009 14:22:32 -0400, Terry Reedy wrote:
Scott David Daniels wrote:
It would be a bit easier if people would bother to mention their
Python version, as we regularly get questions from people running 2.3,
2.4, 2.5, 2.6, 2.7a, 3.0, and 3.1b. They run comput
On May 11, 10:47 am, Terry Reedy wrote:
> anuraguni...@yahoo.com wrote:
> > so unicode(obj) calls __unicode__ on that object
>
> It will look for the existence of type(ob).__unicode__ ...
>
> > and if it isn't there __repr__ is used
>
> According to the below, type(ob).__str__ is tried first.
>
>
anuraguni...@yahoo.com wrote:
so unicode(obj) calls __unicode__ on that object
It will look for the existence of type(ob).__unicode__ ...
> and if it isn't there __repr__ is used
According to the below, type(ob).__str__ is tried first.
__repr__ of list by default return a str even if __rep
yes but my list sometimes have list of lists
On May 10, 2:59 pm, "Diez B. Roggisch" wrote:
> anuraguni...@yahoo.com schrieb:
>
> > ok that explains it,
> > so
> > unicode(obj) calls __unicode__ on that object and if it isn't there
> > __repr__ is used
> > __repr__ of list by default return a str
anuraguni...@yahoo.com schrieb:
ok that explains it,
so
unicode(obj) calls __unicode__ on that object and if it isn't there
__repr__ is used
__repr__ of list by default return a str even if __repr__ of element
is unicode
so my only solution looks like to use my own list class everywhere i
use l
ok that explains it,
so
unicode(obj) calls __unicode__ on that object and if it isn't there
__repr__ is used
__repr__ of list by default return a str even if __repr__ of element
is unicode
so my only solution looks like to use my own list class everywhere i
use list
class mylist(list):
def __
anuraguni...@yahoo.com wrote:
> First of all thanks everybody for putting time with my confusing post
> and I apologize for not being clear after so many efforts.
>
> here is my last try (you are free to ignore my request for free
> advice)
>
> # -*- coding: utf-8 -*-
>
> class A(object):
anuraguni...@yahoo.com wrote:
> First of all thanks everybody for putting time with my confusing post
> and I apologize for not being clear after so many efforts.
>
> here is my last try (you are free to ignore my request for free
> advice)
Finally! This is the first of your posts that makes sen
> "anuraguni...@yahoo.com" (ac) wrote:
>ac> and yes replace string by u'\N{COPYRIGHT SIGN}au'
>ac> as mentioned earlier non-ascii char may not come correct posted here.
That shouldn't be a problem for any decent new agent when there is a
proper charset declaration in the headers.
--
Piet va
anuraguni...@yahoo.com wrote:
class A(object):
def __unicode__(self):
return u"©au"
def __repr__(self):
return unicode(self).encode("utf-8")
__str__ = __repr__
a = A()
u1 = unicode(a)
u2 = unicode([a])
now I am not using print so that doesn't matter stdout can print
u
and yes replace string by u'\N{COPYRIGHT SIGN}au'
as mentioned earlier non-ascii char may not come correct posted here.
On May 10, 9:19 am, "anuraguni...@yahoo.com"
wrote:
> First of all thanks everybody for putting time with my confusing post
> and I apologize for not being clear after so many e
First of all thanks everybody for putting time with my confusing post
and I apologize for not being clear after so many efforts.
here is my last try (you are free to ignore my request for free
advice)
# -*- coding: utf-8 -*-
class A(object):
def __unicode__(self):
return u"©au"
On May 9, 10:08 am, Steven D'Aprano wrote:
> On Sat, 09 May 2009 08:37:59 -0700, anuraguni...@yahoo.com wrote:
> > Sorry being unclear again, hmm I am becoming an expert in it.
>
> > I pasted that code as continuation of my old code at start i.e
> > class A(object):
> > def __unicode__(self)
On Sat, 09 May 2009 08:37:59 -0700, anuraguni...@yahoo.com wrote:
> Sorry being unclear again, hmm I am becoming an expert in it.
>
> I pasted that code as continuation of my old code at start i.e
> class A(object):
> def __unicode__(self):
> return u"©au"
>
> def __repr__(se
sorry for not being specfic and not given all info
"""
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
'Linux-2.6.24-19-generic-i686-with-debian-lenny-sid'
"""
My question has not much to do with stdout because I am able to print
unicode
so
print uni
"Piet van Oostrum" wrote in message
news:m263gagjjl@cs.uu.nl...
"Mark Tolonen" (MT) wrote:
MT> wrote in message
MT>
news:994147fb-cdf3-4c55-8dc5-62d769b12...@u9g2000pre.googlegroups.com...
Sorry being unclear again, hmm I am becoming an expert in it.
I pasted that code as continuat
> "Mark Tolonen" (MT) wrote:
>MT> wrote in message
>MT> news:994147fb-cdf3-4c55-8dc5-62d769b12...@u9g2000pre.googlegroups.com...
>>> Sorry being unclear again, hmm I am becoming an expert in it.
>>>
>>> I pasted that code as continuation of my old code at start
>>> i.e
>>> class A(object):
wrote in message
news:994147fb-cdf3-4c55-8dc5-62d769b12...@u9g2000pre.googlegroups.com...
Sorry being unclear again, hmm I am becoming an expert in it.
I pasted that code as continuation of my old code at start
i.e
class A(object):
def __unicode__(self):
return u"©au"
def _
ru...@yahoo.com wrote:
On May 9, 10:08 am, Steven D'Aprano wrote:
On Sat, 09 May 2009 08:37:59 -0700, anuraguni...@yahoo.com wrote:
Sorry being unclear again, hmm I am becoming an expert in it.
I pasted that code as continuation of my old code at start i.e
class A(object):
def __unicode_
Sorry being unclear again, hmm I am becoming an expert in it.
I pasted that code as continuation of my old code at start
i.e
class A(object):
def __unicode__(self):
return u"©au"
def __repr__(self):
return unicode(self).encode("utf-8")
__str__ = __repr__
doesn't
You're still not asking questions in a way that we can answer them.
Define "Doesn't work." Define "a".
On Sat, 2009-05-09 at 00:04 -0700, anuraguni...@yahoo.com wrote:
> also not sure why (python 2.5)
> print a # works
> print unicode(a) # works
> print [a] # works
> print unicode([a]) # doesn'
> "anuraguni...@yahoo.com" (ac) a écrit:
>ac> also not sure why (python 2.5)
>ac> print a # works
>ac> print unicode(a) # works
>ac> print [a] # works
>ac> print unicode([a]) # doesn't works
Which code do you use now?
And what does this print?
import sys
print sys.stdout.encoding
--
Piet
also not sure why (python 2.5)
print a # works
print unicode(a) # works
print [a] # works
print unicode([a]) # doesn't works
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 08 May 2009 14:22:32 -0400, Terry Reedy wrote:
> Scott David Daniels wrote:
>
>> It would be a bit easier if people would bother to mention their
>> Python version, as we regularly get questions from people running 2.3,
>> 2.4, 2.5, 2.6, 2.7a, 3.0, and 3.1b. They run computers with diffe
> "J. Cliff Dyer" (JCD) a écrit:
>JCD> On Fri, 2009-05-08 at 07:53 -0700, anuraguni...@yahoo.com wrote:
>>> #how can I print a list of object which may return unicode
>>> representation?
>>> # -*- coding: utf-8 -*-
>>>
>>> class A(object):
>>>
>>> def __unicode__(self):
>>> return u"©au"
>>
On Fri, 2009-05-08 at 07:53 -0700, anuraguni...@yahoo.com wrote:
> #how can I print a list of object which may return unicode
> representation?
> # -*- coding: utf-8 -*-
>
> class A(object):
>
> def __unicode__(self):
> return u"©au"
>
> __str__ = __repr__ = __unicode__
>
Your
Scott David Daniels wrote:
It would be a bit easier if people would bother to mention
their Python version, as we regularly get questions from people
running 2.3, 2.4, 2.5, 2.6, 2.7a, 3.0, and 3.1b. They run computers
with differing operating systems and versions such as: Windows 2000,
OS/X Leo
anuraguni...@yahoo.com wrote:
#how can I print a list of object which may return unicode
representation?
# -*- coding: utf-8 -*-
class A(object):
def __unicode__(self):
return u"©au"
__str__ = __repr__ = __unicode__
a = A()
try:
print a # doesn't work?
except UnicodeEncod
#how can I print a list of object which may return unicode
representation?
# -*- coding: utf-8 -*-
class A(object):
def __unicode__(self):
return u"©au"
__str__ = __repr__ = __unicode__
a = A()
try:
print a # doesn't work?
except UnicodeEncodeError,e:
print e
try:
p
29 matches
Mail list logo