5 ms·
dunder is a wonderful way to pronounce "double underscore" methods. It saves a lot of time and syllables.
by paddy_m 14y ago
dunder is a wonderful way to pronounce "double underscore" methods. It saves a lot of time and syllables.
- ConceptJunkie 14y agoPlus it's great set up for the use of the words "head", "-Mifflin" or as a tribute to the long lost mall staple of the 70s, Mr. Dunderbach. Wait, what are we talking about again? Python never fails to amaze me. Everything in the language is a thing that you can redefine. The more I learn about it, the more it reminds me of Lisp, which I had the pleasure (and trauma) of first using more than 25 years ago. Once I wrapped my head around the basics of Lisp, I realized it's a mind-altering experience. I'm long overdue to return to learning more about functional programming.
- AjithAntony 14y ago> Everything in the language is a thing that you can redefine. Pretty much goes for any dynamic language, perl/ruby/javascript/etc...
- masklinn 14y agoNot really, javascript provides very little core behavioral hooks for instance: no creation hook (new/__new__, yeah you can return your own instance in the constructor but it'll still build an instance regardless), no general attribute-access until proxies (method_missing/__getattr__), no operators override (save through toString/valueOf hacks and that won't work for []), no conversion hooks (again, aside from toString/valueOf), etc... Compare and contrast: http://docs.python.org/3/reference/datamodel.html#special-method-names http://docs.python.org/3/reference/datamodel.html#special-me... Ruby provides roughly the same level of hooking (not sure it allows overriding instance or subclass checks, but it allow overriding things Python does not as well), but JS most definitely does not.
- Benvie 14y agoAll of these things are coming as part of the next version of JavaScript, ES6. Proxy is available in Firefox and Chrome behind a flag. Function.prototype.@@create/@@hasInstance is in the ES6 spec.
- masklinn 14y agoAnd thus these things don't "go" for javascript. They might do so in 5 years, informed by the rest. But now, nope.
- ConceptJunkie 14y agoOn the plus side, I checked: Mr. Dunderbak (note spelling) is still around. Now I'm all hungry. Also I definitely need to learn more about Python. It's always deeper than I realize.