> My current dilemma is that I've got a program that takes one argument
> and needs to be run multiple times with this argument being validated
> based on the previous one. So proper usage might be
> myprog red
> myprog blue
> myprog green
> where it would be wrong to do
>
On 5/18/05, Smith, Jeff <[EMAIL PROTECTED]> wrote:
> Is there a more Pythonic way to get the Perl equivalent of
> $#var
> other than
> len(var) - 1
By Pythonic, if you mean OO, you can do this: ['foo', 2, 'baz'].__len__()
--
Premshree Pillai
http://www.livejournal.com/users/prems
y and I would prefer
if now == $#colors
Keep in mind this is not an exact statement of the problem but I believe
it captures the full context.
Jeff
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 17, 2005 6:00 PM
To: Smith, Jeff
Cc: tutor@python.org
S
On Tue, 17 May 2005, Smith, Jeff wrote:
> Is there a more Pythonic way to get the Perl equivalent of
> $#var
> other than
> len(var) - 1
Hi Jeff,
Just out of curiosity, where do you use Perl's $#var? Can you show us the
context of its use? If we see context, it might help us fin
On May 17, 2005, at 22:00, Smith, Jeff wrote:
> Is there a more Pythonic way to get the Perl equivalent of
> $#var
> other than
> len(var) - 1
AFAIK, len(var) - 1 is the only way. Note, however, that the
last element of a list (or of any ordered sequence) can be obtained
with th
Is there a more Pythonic way to get the Perl equivalent of
$#var
other than
len(var) - 1
Thanks,
Jeff
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor