Re: Python syntax in Lisp and Scheme
From: Hannu Kankaanp?? (hanzspam_at_yahoo.com.au)
Date: 10/07/03
- Next message: Johan Kullstam: "Re: 64-bit G5?"
- Previous message: prunesquallor_at_comcast.net: "Re: Python syntax in Lisp and Scheme"
- In reply to: Pascal Costanza: "Re: Python syntax in Lisp and Scheme"
- Next in thread: Terry Reedy: "Re: Python syntax in Lisp and Scheme"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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)
- Next message: Johan Kullstam: "Re: 64-bit G5?"
- Previous message: prunesquallor_at_comcast.net: "Re: Python syntax in Lisp and Scheme"
- In reply to: Pascal Costanza: "Re: Python syntax in Lisp and Scheme"
- Next in thread: Terry Reedy: "Re: Python syntax in Lisp and Scheme"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|