hi!
...
Jacob Rus wrote:
> Andrew Akira Toulouse wrote:
I have not followed the thread, but the line above looks cool and
> Personally, I'd rather have this broken up than in one gigantic line
> that looks like:
>
> result = [int(line) for line in f if evenP(int(line))
> until int(line) == 0 with open(filename) as f]
terrible at the same time.
I can't think what other operator can be squeezed into expression, maybe
try-except, eh?
result = [int(line) for line in f try if evenP(int(line))
until int(line) == 0 except ValueError("blabla")
with open(filename) as f]
I am not sure if this kind of SQLness should enter Python syntax at all...
Regards,
Roman
> !DSPAM:488e7c4d23202007710671!
>
> As for:
>
>> tokenchecks = [token for regex,token in match_tok until
>> regex.match(s)] return tokenchecks[-1]
>
> This is much more readably expressed as:
>
> for regexp, token in match_tok:
> if regexp.match(s):
> return token
>
>
> Cheers,
> Jacob Rus
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas