[Python-Dev] Adding any() and all()
Pierre Barbier de Reuille
pierre.barbier at cirad.fr
Fri Mar 11 14:09:07 CET 2005
And why not use the names already in use in numarray/Numeric ?
They are called "sometrue" and "alltrue" ... IMHO, it explicits more
what it means :
alltrue(i<5 for i in l)
sometrue(i<5 for i in l)
Another point is: as I agree there is already a huge lot of builtins,
shouldn't it be in some module ? Perhaps in itertools ?
Pierre
PS: It's my first post on the list, even if I'm reading it for a few
months now ^_^
Peter Astrand a écrit :
> On Fri, 11 Mar 2005, Paul Moore wrote:
>
>
>>>Not sure this is pertinent but anyway: "any" and "all" are often used
>>>as variable names. "all" especially often and then almost always as a
>>>list of something. It would not be good to add "all" to the list of
>>>words to watch out for. Also, "all" is usually thought of as a list of
>
>
>>Using "any" and "all" as variables hides the builtins, but doesn't
>>disallow their use elsewhere. Personally, though, I wouldn't use "any"
>>or "all" as variable names, so that's a style issue.
>
>
> Even though you can use them as variables (and shadow the builtins), you
> will still get warnings from "pychecker". The code will also be harder to
> read: When you see "all" in the middle of some code, you don't know if
> it's referring to the builtin or a variable.
>
> Personally, I think Python has too many builtins already.
>
>
> /Peter Åstrand <astrand at lysator.liu.se>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/pierre.barbier%40cirad.fr
>
--
Pierre Barbier de Reuille
INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France
tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68
More information about the Python-Dev
mailing list