Live data from Hacker News

Python's Original Sin

andreyf.tumblr.com

21–30 of 55 posts

Re: Python's Original Sin

#21

Python does have a machine readable grammar. The reason Jython isn't at 2.6 is not because of syntax changes, those would probably take less than a day to do, it's all the semantic changes that take time.

You're right, I should have addressed that: there's more to syntax than grammar.

All of the semantic changes I can think of in Python could easily be implemented as syntax transformations in a way portable across implementations. Decorators, the with statement, print-as-a-function, etc... There might be some I'm missing that would be non-trivial as macros, but I'd benefit significantly just from having the ones that are plain syntax sugar without having to convince my team to use a py3-to-2 compiler.

Re: Python's Original Sin

#22

In Smalltalk, this is a non-issue because the language is so small. A good programmer can hand-code a parser for most of Smalltalk in under a day. I know, because I've done it a couple of times. (2 hours is my fastest time.)

To relate this back to the blog post, the original sin is that Python has too much syntax. Every time somebody wants to add a "language" feature, it has to be implemented with some kind of syntactic change, and support for the semantics of the feature has to be added to the interpreter. That's a lot of work, and it means that alternate implementations like Jython can't keep up.

A good example of this is generators. Via PEP 255 they were introduced in Python 2.2, and required the addition of the "yield" statement to the syntax. Recently Squeak (an open-source Smalltalk implementation) added generators to the standard library, with no syntax changes required. It was a much smaller project, and the change can easily be ported to other Smalltalk implementations without participation from the maintainers of the core libraries or virtual machine.

So languages with very simple syntax, like Smalltalk and Lisp just don't suffer from the high level of language evolution friction that Python does. In practice, the diversity of dialects and the ease with which the language can change creates the kind of market system of language features that andreyf mentioned here on HN.

The neat thing about Perl6 is that it takes a different approach. Perl doesn't have a simple syntax like Smalltalk or Lisp. Instead it has a very powerful system for text manipulation that can handle the complexity of Perl's syntax. In theory, that's even more powerful than Lisp macros or Smalltalk's implemented-in-Smalltalk compiler. It'll be very interesting to see how it plays out in practice.

Re: Python's Original Sin

#23
post #21

Python does have a machine readable grammar. The reason Jython isn't at 2.6 is not because of syntax changes, those would probably take less than a day to do, it's all the semantic changes that take time.

You're right, I should have addressed that: there's more to syntax than grammar. All of the semantic changes I can think of in Python could easily be implemented as syntax transformations in a way portable across implementations. Decorators, the with statement, print-as-a-function, etc... There might be some I'm missing that would be non-trivial as macros, but I'd benefit significantly just from having the ones that…

I suggest you take a look at the 2.6 release notes (http://docs.python.org/whatsnew/2.6.html), the number of items on here that constitute simple syntax transformations is dwarfed by the number that require active work in the VM.

Re: Python's Original Sin

#26
post #24

You're still a few layers above the truly fundamental issue. Python's sin is that it has statements at all.

Can you explain what you mean by this please?

He's likely arguing against any non-Functional Language. "Purely functional" Lisp has no statements, side-effects, etc, for instance.

Re: Python's Original Sin

#27
post #10

This is interesting, but I don't know that reality matches the author's theory. After all perl 6 is hardly a shining example of how a language should be upgraded. It's been in the works for at least a decade. Say what you will about python 3, but at least it exists and has been released.

> Say what you will about python 3, but at least it exists and has been released.

Yeah, and nobody is upgrading because it doesn't give you much incentive unless you enjoy breaking backwards compatibility. It has also been in development for at least 5 years.

I don't get why people get version numbers so literally. Perl6 is a new language inspired by Perl5. Python 3 is just a minor enhancement that happens to break backwards-compatibility. The two are not comparable.

Re: Python's Original Sin

#28

Earlier quoted context omitted.

Can you explain what you mean by this please?

He's likely arguing against any non-Functional Language. "Purely functional" Lisp has no statements, side-effects, etc, for instance.

No, he's probably arguing in favor of expressions (i.e. stuff that returns values). Smalltalk has expressions everywhere, with control blocks being just closures passed to methods on objects ...

  a 
> "Purely functional" Lisp has no statements, side-effects, etc, for instance.

Such a Lisp also has no users.

Re: Python's Original Sin

#30
post #6
post #5

And this affects me as a Python user how, exactly?

To down-voters: this is a valid question, and something I cut from the original post (trying to keep to meta-discussion). I'm hitting one related issue right now at work: we want to switch to Jython to take advantage some JVM features, but need to weigh the risk that it might never move past Python 2.5 syntax [1]. That's not a deal-breaker, but I'm an enormous fan of where Python syntax has gone since then, so it pai…

I think the vital quote from Frank's notice is "I fully expect that this new job will deepen my understanding of real world Python coding and make my Jython work more productive."

With this in mind, wouldn't his move away from Jython full time actually make it better (ie infuse new ideas) so we might get 2.6 comparability sometime down the line?

Post reply on HN