1/ Many will tell you why Python is great for teaching coding, so I'll tell you ways it's not.

State is a bad default. It should be legal but safe & rare. The arc of programming is long and bends towards immutability. Its early use creates messes (eg, "a variable is a box".)

2/ Rich and robust programming requires a strong understanding of data models and invariants. Python is weak at expressing either of those. You don't notice it until you miss it. ↵

3/ Mutation is not the same as binding, and variable is not the same as structure mutation. Python uses the same syntax for all three. This leads to confusion over concepts that are important, subtle, and should be clearly distinguished.

4/ Types matter. Annotations matter. Types can be gradual; indeed, there's a strong argument for that. Annotation-checking can be dynamic. But this must be baked into the language. Annotations should not just be ignored. ↵

5/ The use of generators in lots of places is very elegant…for a mature programmer. It is (honestly) unclear to me that this is a good default, as opposed to something you grow into. But Python lacks machinery to define simpler sub-languages, so we can't experiment easily.

6/ There are several weird corner-cases, e.g., in scope, as we documented in our "Python: The Full Monty" paper [cs.brown.edu/~sk/Publications/]. As the appendix shows, this can bite tools. Experts cope. Can beginners? Dunno. ↵

Follow

@shriramk seems like a good thread to port over this doozy from Twitter.

“here's possibly the worst Python scoping rule I've ever seen.”

Try for yourself at replit.com/@elfprince13/Rubber

Sign in to participate in the conversation
Mastodon

General topic personal server.