Python

Jun 18, 2008 02:15

I played around with programming in Python a while ago, but I haven't used it in years. I decided to try it out again for a project I'm working on, and I made a neat discovery -- I helped change the language.

When I started using Python in 2003, one of the first issues I ran into was the lack of a ternary operator or equivalent. There were some workarounds available, but they were all ugly. I asked about it in comp.lang.python, and that started a good-sized thread. A few days later, Guido van Rossum (creator/maintainer of Python) posted PEP 308, a proposal to add conditional expressions to Python, saying "Given that if-then-else expressions keep being requested, I hereby put forward a proposal."

After some discussion and voting, Guido rejected the proposal on the basis that there was no consensus on what the syntax should be. However, a few years later he changed his mind and approved the proposal with the syntax "X if C else Y", and now it's part of Python. A part I made use of today, in fact.

PEP 308 was motivated by a long line of questions and discussions about conditional expressions in Python, not just by my post and the resulting thread, so my main contribution was being the straw that broke the camel's back. That's still kindof cool, though :).
Previous post Next post
Up