curly-brace-aphobic?
Rainer Deyke
root at rainerdeyke.com
Mon Jan 29 17:07:49 EST 2001
"Quinn Dunkan" <quinn at bolivar.ugcs.caltech.edu> wrote in message
news:slrn97bicg.8va.quinn at bolivar.ugcs.caltech.edu...
> On Mon, 29 Jan 2001 08:01:55 GMT, C.Laurence Gonsalves
> <clgonsal at keeshah.penguinpowered.com> wrote:
> >Actually, the thing that's always bugged me is that Python makes a
> >distinction between subscripting (__getattr__) and function calls
> >(__call__). Mathematically speaking, a dictionary is really just a
> >function that maps from 'keys' to 'values'.
>
> Even haskellers usually don't implement finite maps and arrays as
functions
> (though they usually acknowledge that would be the elegant solution).
>
> So even in a language where functions are the major important element,
> efficiency dictates a data-oriented view. And python is pretty
data-oriented
> anyway, so a functional representation would be out of character. And
> mutation is important in python, while a functional representation gives
no
> opportunity for that.
None of these is really a compelling reason for using '[]' instead of '()'
for access. There is no efficiency difference in Python because both are
implemented as (hidden) method calls, and languages like C++ allow 'f(5) =
5;'. Is there any good reason for function calls to use a different syntax
than mapping/sequence element access?
--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list