'for every' and 'for any'
Oren Tirosh
oren-py-l at hishome.net
Sun May 26 06:59:44 EDT 2002
Here's an idea for a possible language enhancement. I'd like to hear your
comments about it. It's inspired by list comprehensions and I think the
examples are pretty self-explanatory:
if not isinstance(x, str) for any x in args:
raise TypeError, "arguments must be of type str"
valid = i>0 for every i in vector
if dict2.has_key(k) for any k in dict1:
...
The words 'any' and 'every' can be non-reserved keywords (like the word 'as'
in "import foo as bar"). They are valid only after the keyword 'for' when
it's used in a non-statement context.
Oren
More information about the Python-list
mailing list