Neil Cerutti wrote:
> On 2006-11-10, Steve Holden <[EMAIL PROTECTED]> wrote:
> >>> But I don't insist on my PEP. The example just shows just
> >>> another pitfall with Unicode and why I'll advise to any
> >>> beginner: Never write text constants that contain non-ascii
> >>> chars as simple strings,
On 2006-11-10, Steve Holden <[EMAIL PROTECTED]> wrote:
>>> But I don't insist on my PEP. The example just shows just
>>> another pitfall with Unicode and why I'll advise to any
>>> beginner: Never write text constants that contain non-ascii
>>> chars as simple strings, always make them Unicode stri
Neil Cerutti wrote:
> On 2006-11-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Marc 'BlackJack' Rintsch wrote:
>>> Why? Python strings are *byte strings* and bytes have values in the range
>>> 0..255. Why would you restrict them to ASCII only?
>> Because getting an exception when comparing
On 2006-11-10, John Machin <[EMAIL PROTECTED]> wrote:
>
> Neil Cerutti wrote:
>> On 2006-10-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> > Hello,
>> >
>> > here is something that surprises me.
>> >
>> > #coding: iso-8859-1
>>
>> I think that's supposed to be:
>>
>> # -*- coding: iso-8859-1
On 2006-11-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Marc 'BlackJack' Rintsch wrote:
>> Why? Python strings are *byte strings* and bytes have values in the range
>> 0..255. Why would you restrict them to ASCII only?
>
> Because getting an exception when comparing a string with a unicode
Neil Cerutti wrote:
> On 2006-10-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > here is something that surprises me.
> >
> > #coding: iso-8859-1
>
> I think that's supposed to be:
>
> # -*- coding: iso-8859-1 -*-
>
Not quite. As PEP 263 says:
"""
More precisely, the first
Marc 'BlackJack' Rintsch wrote:
> Why? Python strings are *byte strings* and bytes have values in the range
> 0..255. Why would you restrict them to ASCII only?
Because getting an exception when comparing a string with a unicode
string is irritating.
But I don't insist on my PEP. The example ju
In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> I didn't mean that the *assignment* should raise exception. I mean that
> any string constant that cannot be decoded using
> sys.getdefaultencoding() should be considered a kind of syntax error.
Why? Python strings are *byte strings* and bytes h
I didn't mean that the *assignment* should raise exception. I mean that
any string constant that cannot be decoded using
sys.getdefaultencoding() should be considered a kind of syntax error.
I agree of course with the argument of backward compatibility, which
means that my suggestion is for Python
[EMAIL PROTECTED] wrote:
> Suggestion: shouldn't an error raise already when I try to assign s2?
variables are not typed in Python. plain assignment will never raise an
exception.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Thanks, John and Neil, for your explanations.
>
> Still I find it rather difficult to explain to a Python beginner why
> this error occurs.
>
> Suggestion: shouldn't an error raise already when I try to assign s2? A
> normal string should never be allowed to contain char
On 2006-10-19, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Suggestion: shouldn't an error raise already when I try to
> assign s2?
There's been discussion on pydev about changing this, but for now
I believe a str is a sequence of bytes in Python, rather than a
string of characters. My current p
Thanks, John and Neil, for your explanations.
Still I find it rather difficult to explain to a Python beginner why
this error occurs.
Suggestion: shouldn't an error raise already when I try to assign s2? A
normal string should never be allowed to contain characters that are
not codable using the
On 2006-10-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello,
>
> here is something that surprises me.
>
> #coding: iso-8859-1
I think that's supposed to be:
# -*- coding: iso-8859-1 -*-
The special comment changes only the encoding of unicode
literals. In particular, it doesn't change
[EMAIL PROTECTED] wrote:
> Hello,
>
> here is something that surprises me.
>
> #coding: iso-8859-1
> s1=u"Frau Müller machte große Augen"
> s2="Frau Müller machte große Augen"
> if s1 == s2:
> pass
>
> Running this code produces a UnicodeDecodeError:
>
> Traceback (most recent call l
Hello,
here is something that surprises me.
#coding: iso-8859-1
s1=u"Frau Müller machte große Augen"
s2="Frau Müller machte große Augen"
if s1 == s2:
pass
Running this code produces a UnicodeDecodeError:
Traceback (most recent call last):
File "tmp.py", line 4, in ?
if s1 ==
16 matches
Mail list logo