Re: Python syntax in Lisp and Scheme

From: Hannu Kankaanp?? (hanzspam_at_yahoo.com.au)
Date: 10/07/03


Date: 7 Oct 2003 07:04:48 -0700

Pascal Costanza <costanza@web.de> wrote in message news:<blu4q0$1568$1@f1node01.rhrz.uni-bonn.de>...
> ...but this means that
>
> collect = []
> for l in some_file_name
> if some_property:
> collect.append(l)
>
> ...is another solution for the single collector case. Now we have two
> ways to do it. Isn't this supposed to be a bad sign in the context of
> Python? I am confused...

It's all about what's the "correct" way to do it. In this case, it
would be

collect = [l for l in some_file_name if some_property]

And this would be expanded to the for-loop form *only* if it is needed.
Of course I can do

x = 5
x += y

Or I can do

x = 5 + y

That's not breaking against Python's principles. The latter
way is the right way.

(surely there are many debatable cases of which is the right
way, but the principle is adhered to as often as possible.
That's the best one can ever have)



Relevant Pages

  • Re: Python syntax in Lisp and Scheme
    ... > ...is another solution for the single collector case. ... And this would be expanded to the for-loop form *only* if it is needed. ... That's not breaking against Python's principles. ...
    (comp.lang.python)
  • Re: Valid Product Keys for Windows XP SP2 Professional Volume License Edition
    ... I compared breaking the EULA to breaking laws like prohibition, slavery, marijuana, etc. and you had no comment. ... Most people that are ethical know that they can protest and argue without breaking the rules/laws - there is nothing to stop you from protesting without breaking the rules/laws. ... When a computer buddy of mine comes back from the States, we will be looking into Linux because, my friend, I have principles and one of those principles is not supporting a monopoly that pretends to tell me what I can or can't do in the privacy of my home with something I bought. ...
    (microsoft.public.windowsxp.general)