Hi Paul

You wrote:

> You [the original poster] seem to want a function[to express the
> criteria], but it's not obvious to me why you need that.


 A function has several advantages.
1. It can be reused.
2. It can be tested (a special case of 1).
3. It can be passed as a parameter (a special case of 1).
4. It can be imported from a different Python module (a special case of 1).
5. The code that uses function can be reused (if the function is passed as
a parameter).

These advantages were sufficient for me at the time to accept the original
poster's desire "to retrieve one of its elements that fits a certain
criteria". That is not to say that in every case a function is the best way
to do things. It's enough that in some (or many) cases using a function is
a good thing.

-- 
Jonathan
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/2W2KHYRRFJ2ZNBI354SRH746SZJ3P4JV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to