The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)
Rustom Mody
rustompmody at gmail.com
Mon Mar 21 03:07:46 EDT 2016
On Monday, March 21, 2016 at 12:11:19 PM UTC+5:30, Steven D'Aprano wrote:
> On Monday 21 March 2016 13:11, Ben Finney wrote:
>
> > BartC writes:
> >
> >> I don't have a clue about exceptions
> >
> > Please, stop making assertions about Python code until you have learned
> > Python.
>
>
> I don't see how "I don't have a clue about exceptions" is an assertion about
> Python code.
>
> I think there's a lot of hostility aimed at Bart, undeserved hostility,
> because he continues to demonstrate that Python is not as fast as it could
> be. I don't see that Bart is trolling or being malicious, although I do
> think he perhaps hasn't fully grasped the idea that *we know*, and we're
> willing to live with reduced speed in favour of certain design choices.
>
> (Ironically, for all that we as a community will go to the battlements to
> fight to the death to keep these dynamic features, we'll also tar and
> feather anyone who actually *uses* them. I've even seen people criticise
> Raymond Hettinger, one of the most experienced and competent senior Python
> guys, because his "namedtuple" uses exec. Go figure.)
>
> I'll ask everyone to please give Bart the benefit of the doubt and assume
> good faith. Rather than snark at him if he writes un-Pythonic code, teach
> him how to write it better, don't just sneer at the poor quality of his code
> or fob him off onto another list.
>
> (Bart, I am also on the tutor mailing list that Ben suggested, and you would
> be welcome them.)
Thanks Steven for a reasonable response.
Mark's comments are in joke category.
He has the highest #posts/#python-knowledge ratio out here
Chris and Ben's responses smell like sour grapes.
Notice how such responses seem to get sharper as the (imagined) criticism of
python increases
Bart(C): The best use of exceptions is to not bother about them:
Ignore:
>>> open("NonExistentFile")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'NonExistentFile'
Handle:
>>> try:
... open("NonExistentFile")
... except IOError as i:
... print i
...
[Errno 2] No such file or directory: 'NonExistentFile'
>>>
So the payoff you get for the 4 extra lines of explicit handling is no traceback
Ok... But tracebacks are not that bad are they?
And JFTR: Pointing out unsatisfactory usage of one language feature
when you are trying to focus on another looks frankly silly to me.
The more reasonable response may be: If you are suggesting a new/changed
feature you should be doing that on the ideas list
About switch/case:
Almost every modern functional language has a case that is way more powerful
(and as efficient) as the imasculated imperative case/switch.
See my post in the other thread on "case" for a small list of such languages
Why settle for a ½-assed choice?
More information about the Python-list
mailing list