The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

Ned Batchelder ned at nedbatchelder.com
Mon Mar 21 16:18:02 EDT 2016


On Monday, March 21, 2016 at 3:43:40 PM UTC-4, BartC wrote:
> 
> This code was adapted from a program that used:
> 
>     readstrfile(filename)
> 
> which either returned the contents of the file as a string, or 0.
> 
> That's all. My Python version was thrown together as I don't know if 
> there's a similar function to do the same.
> 
> If you want to talk about Pythonic, I don't see why that file API 
> doesn't count (the original is buried in a library).
> 
> Or does Pythonic mean bristling with exceptions and classes and what-not?

Steven has argued eloquently that we should welcome you to the Python way
of doing things.  My question to you is: do you want to learn it? 

You already seem to have decided that exceptions and classes are useless. 
You aren't allowing yourself to use regexes, and probably other tools from
the standard library.

Your strategy seems to be to limit yourself to the subset of Python that
overlaps with C, and then complain when something from C is missing. Why?
Perhaps you would just be happier with C?

Help us understand: why are you using Python? Why aren't you interested in
learning what it has to offer?

I'll gladly explain why Python programmers prefer exceptions over returned
error codes, but I'll wait until I know whether you want to know.

--Ned.



More information about the Python-list mailing list