Live data from Hacker News

SICP in Python

wizardforcel.gitbooks.io

101–110 of 136 posts

Re: SICP in Python

#101
post #25

It made me so sad when I found out CS61A was being taught in Python. I love Python, but I also know that I would have missed out on so much wonderful information if I hadn't learned Scheme. It was truly mind blowing when they had us implement a Scheme interpreter in Scheme, and then add infix operators. I think the original SICP was perfect for an intro course. It was also the great leveler, because even if you enter…

When did you attend? I heard from a mentor who'd gone way before me that it used to be taught in Lisp but I wonder if they actually meant Scheme.

[deleted]

Re: SICP in Python

#102
post #25

It made me so sad when I found out CS61A was being taught in Python. I love Python, but I also know that I would have missed out on so much wonderful information if I hadn't learned Scheme. It was truly mind blowing when they had us implement a Scheme interpreter in Scheme, and then add infix operators. I think the original SICP was perfect for an intro course. It was also the great leveler, because even if you enter…

When did you attend? I heard from a mentor who'd gone way before me that it used to be taught in Lisp but I wonder if they actually meant Scheme.

I took 61A in Fall of ‘96.

As far as I know it was taught in Scheme since SCIP came out in the 80s.

Re: SICP in Python

#103
post #7

Earlier quoted context omitted.

I concur, this book is a terrible way to introduce anybody to Python. I imagine they want to teach general programming skills, and hence want to give you a "way to think" that is low level enough to let you work with any language, using Python as a pseudo-code to demonstrate it. This approach is doomed to fail. It's much better to teach the language properly, then introduce other languages as a comparison point, if t…

SICP shouldn't really be taught in any language other than Scheme, or a language designed specifically for teaching SICP. It doesn't make sense otherwise.

To disagree with you, I took the Python version of UCB's CS61A and I learned quite a lot (especially coming from a non-programming background). Perhaps other forms of SICP are better, but CS61A was a really enjoyable course overall and was part of the reason I decided to switch majors to Computer Science.

Re: SICP in Python

#104
post #48
post #39

Earlier quoted context omitted.

In line with this, list comprehensions are one area of python I find particularly clunky. They work fairly well for a single map or filter operation, alright for both mapping and filtering, and are absolutely unreadable for anything more complicated. A big part of this in my opinion is how they scramble the flow. Instead of taking a piece of data and performing successive operations on it, both in logic and in syntax…

map(lambda x:x^2, filter(lambda x:x%6==0, map(lambda x: x*2, getNumbers()))) Would probably be a more pythonic way to do that, avoiding list comprehensions. Easier to read with added lines and indentation. But tbf I do appreciate the ability to chain operations in JS without subclassing objects like list.

Also this is still confusing because you need to read it backwards. Pipelines are just better in every way, if you ask me.

Re: SICP in Python

#105
post #67

Earlier quoted context omitted.

For what it’s worth, I’m not a Python programmer and I got that correct. The answer is: [1] [1, 1] [1, 1, 2] [3] It relies on knowing something about how python applies default arguments. I’ve only written about a hundred lines of python in my life, so possibly I just got lucky - still, I would have thought an actual Python programmer should get this?

It is different from how Ruby and Javascript handle default arguments. I'm surprised Python does that, since I would expect function arguments to be reset to their defaults each call. That's a major side effect.

It's pretty odd behavior, yeah. It's easy to work around (set the default to None and then set the actual default in the function body), but I don't know if I've _ever_ seen anyone want it to behave as it does now.

Re: SICP in Python

#106
post #4

I'm so used to syntax highlighting that it feels odd to try to read code without highlighthing A bit off-topic, now that legacy.gitbook.com will be read-only from next month, anyone else just giving up on the platform? I used it mainly to allow readers to easily get pdf/epub versions and as far as I know, that won't be possible with new gitbook site.

By the way that is one of reasons for using scheme -- there's hardly any syntax, and definitely none of the confusing distinction between statements and expressions. There's not much value to syntax highlighting in such an environment.

Remember: when the course was introduced (ca 1981) few of the freshman had ever used a computer before they arrived at MIT. The first lecture included an second on "how to program in scheme" and after that it was assumed you could do all the assignments. This book has to include a much more complex (and I would imagine to the new programmer, daunting) introduction to dealing with Python.

I feel like the scheme version was a more nuts and bolts class full of practical information while this Python version feels less practical. But that could be a bias on my part.

There are good reasons to switch the instruction to Python (the libraries, mainly) but in exchange something is lost. Engineering is all about dealing with such tradeoffs :-).

Re: SICP in Python

#107
post #8
post #6

Manual of Ice-Fishing rewritten for desert nomads.

in the software world, one can avoid the monster that is c++ rather successfully, but it's gotten to the point that no matter what, python is thrust upon you to deal with. "hey here's this thing that is barely working" (in large part because it's written in python) "and we'd like you to maintain it but not switch from python" (because anything besides python makes us uncomfortable). meanwhile, python makes me uncomfo…

Since I need performance, multithreading etc my code is in C++ and has a Python interface.

The languages and their power are so different that in the end it wasn't worth trying to use any of the quasi-automated linkage tools and instead the Python interface is built by hand. NumPy and such had to take this tack as well.

Re: SICP in Python

#108
post #80

Earlier quoted context omitted.

This relates heavily to the "what language should be taught in schools" argument. I usually answer "Java". And it's not even that I particularly like Java, it's just that the discussion often neglects that the course involved is all about classes, getters and setters, inheritance and so on. It's nonsense to shoehorn this into many other languages.

Dijkstra once said: "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." I find much the same to often be true for many Java programmers. Programmers who start out with a course all about classes, getters and setters, inheritance and so on often end up with their minds wedged such…

Dijkstra was empirically wrong about that (generations of perfectly good programmers were taught BASIC first in schools) and about most of the other witty and self-congratulatory quotes in that collection: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EW... Perhaps the most amusingly wrong one is the claim of FORTRAN, which sits at the core of the scientific Python stack, as "hopelessly inadequate for whatever computer application you have in mind today [i.e., 1975]: it is now too clumsy, too risky, and too expensive to use."

Dijkstra was good at many things, but there's no need for an argument from authority when we have actual data and not just opinions made to sound stronger because they are phrased more aggressively.

Re: SICP in Python

#109
I prefer the scheme version, though the addition of 'distributed and parallel computing' chapter is really important and I welcome such new additions.

Unfortunately 'distributed and parallel computing' is no where to be seen in R*RS. I hope we can change that soon.

Re: SICP in Python

#110
post #25

It made me so sad when I found out CS61A was being taught in Python. I love Python, but I also know that I would have missed out on so much wonderful information if I hadn't learned Scheme. It was truly mind blowing when they had us implement a Scheme interpreter in Scheme, and then add infix operators. I think the original SICP was perfect for an intro course. It was also the great leveler, because even if you enter…

I believe the "self-paced" version is still in Scheme. I did it a couple years ago and it was awesome. The final project was changed to a python interpreter in Scheme which I thought was fantastic.

> The final project was changed to a python interpreter in Scheme which I thought was fantastic.

That is fantastic! ;-)

Post reply on HN