[Tutor] Perl equivalent of $#var

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed May 18 00:00:16 CEST 2005



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 find a Python
idiom that fits the usage.

Best of wishes!



More information about the Tutor mailing list