So I'm a longtime perl hacker, and never really bothered to learn
python - I couldn't see that it would give me anything too different
to justify me using it (cf knowing languages that fill different
niches - F#, C++, javascript, C# [yuck], smalltalk, prolog etc).
But then I started using Google App Engine, which provides a Java or a
Python API, and so I figure it's time to get acquainted.
And bits of it I like - the builtin library is much larger and cleaner
than perl, I can live with whitespace-instead-of-braces (altho without
the functional constructs of F# I fail to see significant benefits and
it doesn't half make some refactoring operations very error prone),
and for the most part it's not too different. Some things are just
typical "context switch" annoyances in a multi-language project and
are not a fault in python (remembering to use "
&&" or "
and", quoting
keys in object/dict literals, "
self"/"
this", "
false"/"
False"/"
FALSE"
etc).
But the bits that annoy most are it's like they've copied perl, but
not caught what it's about, where "regularity" seem to have ground out
"humanity" - like "
pydoc" vs "
perldoc".
perldoc gives me something first off. It might go on to give me to
much, or have to go on about how something changes in different
contexts, or I might have to "perldoc perlfunc" to find builtin
functions by category, but generally I can find what I want and it
tries to put the most important stuff first and the more obscure stuff
later.
pydoc on the other seems perversely geared to first telling me all
sort of internal admin gubbins. Trying to remember something dumb like
how to check if a key exists in hash/dict/object I can do "pydoc
dict", but what do I get first up ?
-- Help on class dict in module __builtin__: class dict(object)
| dict() -> new empty dictionary
| dict(mapping) -> new dictionary initialized from a mapping object's
| (key, value) pairs
| dict(iterable) -> new dictionary initialized as if via:
| d = {}
| for k, v in iterable:
| d[k] = v
| dict(**kwargs) -> new dictionary initialized with the name=value pairs
| in the keyword argument list. For example: dict(one=1, two=2)
|
| Methods defined here:
|
| __cmp__(...)
| x.__cmp__(y) <==> cmp(x,y)
|
| __contains__(...)
| D.__contains__(k) -> True if D has a key k, else False
|
First off I get constructors, sort of useful, although not as useful
as a brief word on what the class is and does.
The explanations are that great computer science invention -
explanations that leave you knowing less, so now I have to look up
what "iterable" and "mapping" objects are - are these vague concepts,
interfaces, base classes, generic terms, duck-typing style interfaces
etc.
But hey, I didn;t even what these, so what follows .... hmm, lots of
methods that start and end with "__" - a classic sign of "These are
internals, don't use them, don;t fiddle with them unless you
REALLY know what you're doing, please pretend they don't exist". So why are
they at the top of the helpfile ?
And then after these somewhere come the normal methods
| clear(...)
| D.clear() -> None. Remove all items from D.
|
| copy(...)
| D.copy() -> a shallow copy of D
|
| get(...)
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
| has_key(...)
| D.has_key(k) -> True if D has a key k, else False
Explanations of the fewest possible words, well ok, these are the
basics, but written in pseudo-code in a mixture of the language and
bits that aren't in the language (is "->" part of the function
definition syntax like some functional languages - not that I've seen)
- pardon my WTF !
The documentation looks like it's been generated (spare me please from
the default output of doxygen and javadoc and the like - it's like
reading the code with all the helpful bits removed) and in that
brain-dead way of 'here's all the details in alphabetical order, we
have no idea of any structure or importance so we've sorted it, just
to be sure that if there was any logical groupings in the source then
we've destroyed that tiny little accomodation of human-to-human
communcation too'.
Consistency, regularity, homogeneity are all good, but when it comes
at the cost of practical use, human accomodation, communication,
navigation - well then it sucks.
I'd draw a comparison with the contrast between a shopping mall where
all the malls are identical in size, colour, decoration, all the shops
are the same size, and all the shop assistants have that same glazed
"have a nice day" look (but can't actually do anything like look in a
stock room or contact a supplier) and a city with nonsensical road
layouts, arbitrary names, some rubbish shops, some sullen assistants,
but in general the "big bright" shops are on the major thoroughfares
and the specialist places are in pokey back streets. You might have to
look for service, but you can get it, and you can remember the streets
by their look, their feel, their smell. And when you walk into your
favourite tech shop and the new guy behind the counter grins and says
"have a nice day", well, you turn on your heel and walk out pretty
damn smart to find somewhere different.