Slices time complexity

Marko Rauhamaa marko at pacujo.net
Tue May 19 03:12:38 EDT 2015


Rustom Mody <rustompmody at gmail.com>:

> However conceptually/pedagogically making a fundamenal distinction of
> timeless | time
> value | object
> immutable | mutable
> expression | statement
> function | procedure
>
> is key to getting programming [and is something that Pascal got better
> than most of its successors].
>
> The FPers want to squeeze the whole world into column 1
> The OOPers want to do the opposite and are embarrassed by the existence of
> column-1 [status of int in java etc]
> Unless one is committed to some philosophical extreme position --
> Only One True Way -- I believe accepting two fundamentals is the most
> sane choice

I sympathize. Can you get Python without getting a language like C
first? Can a baby be born without an umbilical cord? Can you skip Newton
and go straight to quantum mechanics and relativity? I have noticed some
experienced Java programmers are a bit lost in the woods because they
don't have an idea of what is going on under the hood.

Scheme almost gets away with the dilemma but must face it with pairs:

    A pair (sometimes called a dotted pair) is a record structure with
    two fields called the car and cdr fields (for historical reasons).
    Pairs are created by the procedure cons. The car and cdr fields are
    accessed by the procedures car and cdr. The car and cdr fields are
    assigned by the procedures set-car! and set-cdr!.

    Pairs are used primarily to represent lists.

    <URL: http://www.schemers.org/Documents/Standards/R5RS/HTM
    L/r5rs-Z-H-9.html#%_sec_6.3.2>

What is a "record structure?" What is a "field?" What is "creation?"

Still, I don't like the dichotomy of boxed/unboxed values. Is a Python
integer an "object" or a "value?" The Faithful have a surefire answer,
but I think the key is: who cares? What matters is the effect of a
program. If two metaphysical formulations of language semantics produce
the same outcome, neither is objectively better than the other.

Pedagogically, I think you could introduce topics with half-truths and
simplifications, and revisit them later with corrections when the
students are better equipped to handle the abstractions.


Marko



More information about the Python-list mailing list