sam at mas.pl
Mon Mar 31 12:59:13 CEST 2008
Steve Holden napisał(a):
>> 1. You have different syntax for named and unnamed (lambdas)
>> functions. Functions and methods are different things in Python even
>> if they have same syntax. But all these are still a pieces of code
>> that you use repeatedly to make some task.
> A knife and scissors are both used to cut things, but that doesn't mean
> they are the same.
Well -- sometimes you have to use many, many types of scissors.
> I think you are bundling quite different things together here. The
> difference in semantics between bound methods (where the instance
> reference is added as a first argument) and regular functions (where no
> additional argument is supplied) has nothing to do with the difference
> between function and lambda definition syntax.
You are right. One is syntax issue, and the second is language implementation
issue. It would be better to have one unified syntax and one unified
> The desire to provide information hiding is fundamentally against the
> Python philosophy, which basically says that attribute values are
> exposed for all to see. This avoids the nonsense of having to provide
> setter and getter methods which Java imposes on the programmer.
This philosophy is great and makes Python such a good language. But you can't go
beyond what programmers need. If you do so, then you will have to implement
tricks as __id.
More information about the Python-list