On 4/19/2012 7:14 AM, Kiuhnm wrote:
On 4/19/2012 6:21, lkcl wrote:
yeah, it does :) python is... the best word i can describe it is:
it's beautiful. it has an elegance of expression that is only marred
by the rather silly mistake of not taking map, filter and reduce into
the list object itself: l.map(str) for example would be intuitive,
compact and elegant.
It would be WRONG! Those functions are NOT list methods. They are
functions that apply to ANY serialized collection, which is to say, ANY
iterable (which includes iterators). This deep orthogonality is, in my
opinion, part of the deep elegance of Python.
>> instead, i have to look up how to use map each
and every damn time! the reason for the mistake is historical: map,
filter and reduce were contributed by a lisp programmer. that lisp
programmer, presumably, was used to everything being function(args...)
and it simply didn't occur to anyone to properly integrate map, filter
and reduce properly into the list objects that they work with.
Because, again, map, filter, and reduce do not work with list objects.
They work with iterables. People make the same mistake when they say
that join should be a list method, even though lists are not one of
join's parameter types.
I sometimes avoid classes because prefixing hundreds of identifiers with
'self.' makes the code uglier and much less readable.
You can shorten the prefix to, for instance, 's.' if you wish.
I don't like when a community imposes style on a programmer. For
instance, many told me that I shouldn't use camelCase and I should
adhere to PEP8.
PEP8 is a style guide for *new* stdlib code. Guido has asked that core
developers not revise non-comforming but working library code only
because of its non-conformance. The risk of getting conforming but buggy
code is too great. (Revising style while editing and testing otherwise
is a different matter.)
The PEP itself disclaims being a straightjacket. Anyone who clubs you
with it is violating it.
I want to retain my freedom of expression.
You do, just as others are free to opinionate when reading your code ;-).
PEP 8 surprise! It has a line about always surrounding binary operators
with spaces. Many developers disagree. When this came up on pydev list,
Guido said "I did not write that and do not agree. Change it."
I'm also tired of hearing mottos such as TIMTOWTDI...
> oops, that's Perl.
I think Tim meant for the Zen to be a summary and stimulus of thought,
not a substitute for thought.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list