On 16/03/2016 10:52, Antoon Pardon wrote:
Op 16-03-16 om 10:51 schreef Mark Lawrence:
On 16/03/2016 09:35, Antoon Pardon wrote:
Op 16-03-16 om 09:47 schreef Mark Lawrence:


Same with switch. You can use a hash table etc. to simulate switches,
but only if the codeblocks are independent. Otherwise, if-elif chains
are the way to go. Command line parsing is a case where switch
statements are often used, e.g. in shell scripts.

I've seen at least six different ways of simulating switches, so those
people who want them, can have them.  if-elif chains are not likely to
kill any Python programmer.

I have no interest what other languages use switch/case statements
for, as we've on the PYTHON mailing list.

There once were multiple ways to simulate a conditional expression.
And it was generally thought that using if else statements instead
of a conditional expression was unlikely to kill any Python programmer.

But then one of the core developers was bitten by a nasty bug because
he was using one of those constructs that simulated a conditional
expression and soon enough Python had a conditional expression.

So I guess those who would like a case statement in Python can
only hope a core developer gets bitten by a nasty bug while using
one of those ways of simulating switches.


So that core developers can waste their time putting something into
the language that we've done without for 25 years, yes, that strikes
me as extremely worthwhile.

Do you think python should stop progressing? Because all progress
python wil make, will be done by putting something in the language
we've done without for 25 years.

That we have done without doesn't contradict it can be useful to have.


Raise the item on the python-ideas mailing list for the umpteenth time then, and see how far you get. The last attempt that I can find starts here https://mail.python.org/pipermail/python-ideas/2014-April/027665.html. The BDFL reply at https://mail.python.org/pipermail/python-ideas/2014-April/027667.html was:-

<quote>
I don't want to discourage you too much, but I think that adding a switch statement comes *very* low on the list of improvements we would like to make in Python 3.5.

We should probably focus on speed (or aspects of it, like startup),
language features that help porting Python 2 code to it (e.g. bytes
formatting), and things that improve the user experience of getting started with Python on a new machine (e.g. pip/venv). Or perhaps stdlib issues like an asyncio-infused variation of WSGI.

I've probably missed a few focus areas, but I still very much doubt we'll be adding a switch statement -- it's a "sexy" language design issue (like anonymous functions) but that's not what will help Python compete.
</quote>

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to