[Tutor] Combining dictionaries

bob bgailer at alum.rpi.edu
Wed Sep 7 19:10:55 CEST 2005


I enjoy "philosophical" discussions like this. To help us have common 
terminology I present some quotes from dictionary.com:

---------------------------------------------------------------
bug:

An unwanted and unintended property of a program or piece of hardware, 
especially one that causes it to malfunction. Antonym of feature.

---------------------------------------------------------------
feature:

An intended property or behaviour (as of a program). Whether it is good or 
not is immaterial (but if bad, it is also a misfeature)

---------------------------------------------------------------
misfeature:

A feature that eventually causes lossage, possibly because it is not 
adequate for a new situation that has evolved. Since it results from a 
deliberate and properly implemented feature, a misfeature is not a bug. Nor 
is it a simple unforeseen side effect; the term implies that the feature in 
question was carefully planned, but its long-term consequences were not 
accurately or adequately predicted (which is quite different from not 
having thought ahead at all). A misfeature can be a particularly stubborn 
problem to resolve, because fixing it usually involves a substantial 
philosophical change to the structure of the system involved.

Many misfeatures (especially in user-interface design) arise because the 
designers/implementors mistake their personal tastes for laws of nature. 
Often a former feature becomes a misfeature because trade-offs were made 
whose parameters subsequently change (possibly only in the judgment of the 
implementors). "Well, yeah, it is kind of a misfeature that file names are 
limited to six characters, but the original implementors wanted to save 
directory space and we"re stuck with it for now."

-----end of definitions ----------------------------------

>Does not it seem odd that if a and b are dictionaries, c = a + b does not
>result in their union?

Given that the (relatively new) set type in Python, use boolean operators & 
and | for union and intersection, I'd prefer & to +.

>Does it not seem to violate the Principal of Least Astonishment to notice
>what print "spam " "eggs"*3 does?

Any language that imposes operator precedence will have unexpected 
outcomes. That is why I have always liked APL, which has no precedence. 
Strictly right-to-left evaluation with () to group operations in some other 
order.

>And, surely, you are not suggesting that Python 2.4 represents the zenith of
>programming language design?

I certainly hope not. I am merely asserting that there is a design that has 
evolved over 14 or so years, and that my ability to use a language depends 
on my learning it rather than expecting it to behave the way I want 
(expect) it to.

Having worked with APL I am always disappointed that Python does not have 
native array operations. I 'd like to write [1,2,3] + [2,4,6] and get 
[3,6,9], and +/[1,2,3] and get 6. Unfortunately Python does not work that way.

Having recently used Javascript I find it has features that make some 
aspects of programming easier than Python!

>Incidentally, I've been writing compilers and interpreters since 1968 and have
>an EECS degree from MIT, so I do have a clue.

I started studying formal language theory (on my own) in 1972, maintained 
the APL interpreter in 1975 and devised and helped implement my first 
language in 1976. My BSEE from RPI predates any CS departments.

Bob Gailer
phone 510 978 4454  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050907/ed9b8b1e/attachment.html


More information about the Tutor mailing list