Late-binding of function defaults (was Re: What is a function parameter =[] for?)

BartC bc at freeuk.com
Thu Nov 26 07:53:27 EST 2015


On 26/11/2015 01:52, Ned Batchelder wrote:
> On Wednesday, November 25, 2015 at 8:23:36 PM UTC-5, BartC wrote:
>> On 26/11/2015 00:31, Steven D'Aprano wrote:

>>> It really, truly isn't. Your viewpoint is clouded by too much immersion in
>>> crippled languages. *Old and obsolete versions* of crippled languages.
>>> Dynamic creation of functions goes back to the 1950s.

>> It's funny then that the vast majority of top-level function definitions
>> I see in Python (and import and class statements too) are decidedly static.

> I almost started to explain about how yes, Python is often written in
> conservative static ways. I was going to mention that a little dynamic
> nature goes a long way, and is never far from the surface in even the
> simplest Python programs.
>
> But I won't, because I'm not sure you're really interested.  There's a
> pattern here of people trying to explain Python to you, and eventually,
> after many words, getting to some kind of shared understanding, only
> for you to shrug it all off as a fad, or pocket-lining, or needless
> complexity.

I'm sorry if I've been misunderstood.

I simply stated that Python's approach was novel. Steven D'Aprano then 
responded by belittling my view, and effectively trashing every language 
I've ever used.

But as it happens I do think features like first class functions are 
overrated (and probably the software underpinning the hardware we're all 
using is written in the very languages he despises). I don't think a 
language is worthless without such a feature.

 > For someone who claims to be interested in language design, you're
 > remarkably dismissive of pretty much the entire industry.  I don't think
 > it's worth the effort to try to change your mind.

I did say somewhere in this thread or the other one, that I liked 
Python's model well enough that I tried to emulate it in my own 
language. That's not being dismissive! (It don't work because the 
languages are too different internally; I'll have to save it for a 
separate, higher-level language.)

Also, as an implementer, you can understand that I might view certain 
features differently from other people. Dynamic features do make it 
harder to implement things efficiently, and you have to decide whether 
it's worthwhile for the 1% of the time they might be used.

------------------------------------------

FWIW here is that list of features that are different between Python and 
my language, or that work a different way, or that I think could be a 
useful addition. (Although Python's internal workings make many 
impractical.)

http://pastebin.com/JrVTher6

This is not an attempt to compare the complete languages as they are for 
different purposes (mine is more low-level, simpler, smaller and 
designed to make it easier to create an efficient byte-code interpreter 
for it).

-- 
Bartc





More information about the Python-list mailing list