Nick Coghlan wrote:
> I guess my point is that expressions are appropriate sometimes, functions are 
> appropriate other times, and it *is* possible to give reasonably simple 
> guidelines as to which one is most appropriate when (one consumer->deferred 
> expression, multiple consumers->named function).

I don't think this guideline is really valuable. If you transfer this to
variables, you would get "one reader -> inline expression, multiple
readers -> named variable".

This is clearly wrong: it is established practice to use local variables
even if there is only one access to the variable, if creating the
variable improves readability of the code (e.g. if the expression is
very complex).

For functions, the same should hold: if it improves readability, make it
a local function.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to