On Sat, 17 Jul 2010 05:44:07 am pk wrote:

> In general, the shorter and more descriptive a variable name is, 
> the better.

That's a generalisation that is contradictory. Short works against 
descriptive. Compare:

n  # nice and short
number_of_widgets_ordered  # nice and descriptive, if a bit wordy
widgets_ordered  # a happy medium

Which is appropriate depends on the context. Generally, descriptive 
names are self-documenting and are to be preferred, but it is possible 
to overdo it:

def multiply_two_numbers_and_add_one(
    first_number_to_multiply_by, second_number_to_multiply_by
    ):
    return first_number_to_multiply_by*second_number_to_multiply_by + 1


The more terse version is simple enough to understand:

def mult_plus_one(x, y):
    return x*y + 1



-- 
Steven D'Aprano
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to