Neil Cerutti wrote:
> On 2007-09-10, Steve Holden <[EMAIL PROTECTED]> wrote:
>>> I have a quibble not with the functionality of the boolean check,
>>> but with its expressiveness. if y[0] == "" expresses more, i.e.,
>>> that I expect y[0] to contain a Python byte string.
>> I have a quibble with a
Hamilton, William wrote:
>> From: Steve Holden
>> Neil Cerutti wrote:
>>> On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote:
On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> Agreed; but I prefer 'if y[0] == ""', absent more context and
> better names.
Probably should use
> From: Steve Holden
> Neil Cerutti wrote:
> > On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote:
> >> On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> >>> Agreed; but I prefer 'if y[0] == ""', absent more context and
> >>> better names.
> >> Probably should use u"" if you're going to take
On 2007-09-10, Steve Holden <[EMAIL PROTECTED]> wrote:
>> I have a quibble not with the functionality of the boolean check,
>> but with its expressiveness. if y[0] == "" expresses more, i.e.,
>> that I expect y[0] to contain a Python byte string.
>
> I have a quibble with a test that will raise an
Steve Holden wrote:
> Neil Cerutti wrote:
> >>> y = ""
> >>> if y[0] == "":
> ... print "True"
> ... else:
> ... print "False"
> ...
> Traceback (most recent call last):
> File "", line 1, in
> IndexError: string index out of range
> >>>
>
Uhm, weren't we talking about a list of strings?
> "Chris Mellon" <[EMAIL PROTECTED]> (CM) wrote:
>CM> On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>>> Agreed; but I prefer 'if y[0] == ""', absent more context and
>>> better names.
>CM> Probably should use u"" if you're going to take that route, as this
>CM> will fail spuriously if
Neil Cerutti wrote:
> On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote:
>> On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>>> Agreed; but I prefer 'if y[0] == ""', absent more context and
>>> better names.
>> Probably should use u"" if you're going to take that route, as
>> this will fail
On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote:
> On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> Agreed; but I prefer 'if y[0] == ""', absent more context and
>> better names.
>
> Probably should use u"" if you're going to take that route, as
> this will fail spuriously if y[0] conta
On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote:
> > On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> >> On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote:
> >> > Lawrence D'Oliveiro wrote:
> >> > if y[0]:
> >> N
On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote:
> On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>> On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote:
>> > Lawrence D'Oliveiro wrote:
>> > if y[0]:
>> Not a good idea.
>> >>> Why not?
>> >>
>> >> Because there is a s
On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote:
> > Lawrence D'Oliveiro wrote:
> > if y[0]:
> Not a good idea.
> >>> Why not?
> >>
> >> Because there is a situation where your version of the test
> >> will fail even if t
On 2007-09-08, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote:
> Lawrence D'Oliveiro wrote:
> if y[0]:
Not a good idea.
>>> Why not?
>>
>> Because there is a situation where your version of the test
>> will fail even if the first element of y is non-null.
>
> Such as? Seriously people, a
Lawrence D'Oliveiro wrote:
if y[0]:
>>> Not a good idea.
>> Why not?
>
> Because there is a situation where your version of the test will fail even
> if the first element of y is non-null.
Such as? Seriously people, a little more verbosity wouldn't hurt here.
This isn't a mystery game.
/W
In message <[EMAIL PROTECTED]>, Wildemar
Wildenburger wrote:
> Lawrence D'Oliveiro wrote:
>
>> In message <[EMAIL PROTECTED]>, Chris
>> Mellon wrote:
>>
>>> On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:
Doran, Harold wrote:
>
> Is there a way to check if the first element of y i
Steven D'Aprano wrote:
> On Fri, 07 Sep 2007 11:12:05 +0200, Wildemar Wildenburger wrote:
>
>> Lawrence D'Oliveiro wrote:
>>> In message <[EMAIL PROTECTED]>, Chris
>>> Mellon wrote:
>>>
On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:
> Doran, Harold wrote:
>> Is there a way to chec
On Fri, 07 Sep 2007 11:12:05 +0200, Wildemar Wildenburger wrote:
> Lawrence D'Oliveiro wrote:
>> In message <[EMAIL PROTECTED]>, Chris
>> Mellon wrote:
>>
>>> On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:
Doran, Harold wrote:
> Is there a way to check if the first element of y is nu
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Chris Mellon
> wrote:
>
>> On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:
>>> Doran, Harold wrote:
Is there a way to check if the first element of y is null?
>>> len(y[0]) == 0
>>>
>> Better spelled as
>>
>> if y[0]:
>
> N
In message <[EMAIL PROTECTED]>, Chris Mellon
wrote:
> On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:
>> Doran, Harold wrote:
>
>> >
>> > Is there a way to check if the first element of y is null?
>> >
>>
>> len(y[0]) == 0
>>
>> would be the obvious way, assuming "null" means "the null string"
> Doran, Harold wrote:
>
> I presume you meant
>
> x = ' \t\'ff'
>
>
> > Is there a way to check if the first element of y is null?
> >
You can use startswith() method of string objects.
if x.startswith(' '):
print True
--
O.R.Senthil Kumaran
http://uthcode.sarovar.org
--
http:/
On 9/5/07, Chris Mellon <[EMAIL PROTECTED]> wrote:
>
> On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:
> > Doran, Harold wrote:
>
> > >
> > > Is there a way to check if the first element of y is null?
> > >
> >
> > len(y[0]) == 0
> >
> > would be the obvious way, assuming "null" means "the null
On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote:
> Doran, Harold wrote:
> >
> > Is there a way to check if the first element of y is null?
> >
>
> len(y[0]) == 0
>
> would be the obvious way, assuming "null" means "the null string".
>
Better spelled as
if y[0]:
--
http://mail.python.org/mailm
Doran, Harold wrote:
> Dear list:
>
> Suppose I have a string as follows
>
> x = ' \t'ff'
> >>> x = ' \t'ff'
File "", line 1
x = ' \t'ff'
^
SyntaxError: invalid syntax
>>>
I presume you meant
x = ' \t\'ff'
> I can split this up as
>
> y = x.split('\t')
>
> Which
22 matches
Mail list logo