Metaclass programming in Python, Part 2
started 9/10/2003; 8:24:34 AM - last post 9/16/2003; 5:09:06 AM
|
|
Ehud Lamm - Metaclass programming in Python, Part 2
9/10/2003; 8:24:34 AM (reads: 17395, responses: 9)
|
|
Metaclass programming in Python, Part 2 |
Michele [Simionato] and David [Mertz]'s initial developerWorks article on metaclass programming prompted quite a bit of feedback, some of it from perplexed readers trying to grasp the subtleties of Python metaclasses. This article revisits the working of metaclasses and their relation to other OOP concepts. It contrasts class instantiation with inheritance, distinguishes classmethods and metamethods, and explains and solves metaclass conflicts.
Somehow I think most readers will be as perplexed by this article as they were by its predecessor. The lucky ones will find a friendly LtU reader to help them out...
Posted to Python by Ehud Lamm on 9/10/03; 8:26:16 AM
|
|
|
|
Dominic Fox - Re: Metaclass programming in Python, Part 2
9/10/2003; 1:04:37 PM (reads: 808, responses: 0)
|
|
Not to brag - I haven't enough to brag about for it to be really worthwhile - but I found the original article perfectly intelligible...
Some credit is due to David Mertz for having run a series of articles covering things like coroutines, microthreads and the use of functional programming idioms in Python: he's done a good job of introducing such matters to curious Pythonistas. Not everybody is so curious, however. I do sometimes get the rather dispiriting impression that GvR intended Python for the incurious.
|
|
Patrick Logan - Re: Metaclass programming in Python, Part 2
9/10/2003; 8:32:04 PM (reads: 757, responses: 0)
|
|
I do sometimes get the rather dispiriting impression that GvR intended Python for the incurious.
My impressions of OSCON 2003 in Portland...
The Python community there had a mix of people, some seemed affiliated with the Perl community, i.e. they were nuts and bolts keep this web app or database connection running kinds of programmers. Not too interested in language design per se, but interested just in what to do to get something working. Not too curious beyond that.
The other significant group of Python people were more affiliated with the Ruby community (which seemed almost entirely made of this type). These folks were language designers and/or language enthusiasts, or at least curious-enough programmers.
GvR seemed to have a foot in both camps, probably more in the latter but with an eye toward the people in the former in that he knows Python has to work for them in order to continue to be successful.
My two cents based on a few days at this conference for the first time.
|
|
Tayssir John Gabbour - Re: Metaclass programming in Python, Part 2
9/10/2003; 9:15:54 PM (reads: 744, responses: 0)
|
|
Mertz has a great response from people I know because he appeals to the pythonic ideal of readability; for example, a mathematician friend actually sent me an email telling me about how Mertz's text processing solidified his interest in functional programming, since the arguments were completely "honest" and analyzed when FP helped readability. (We pair programmed and so he started using map/filter/reduce/listcomps, but didn't quite have the language to articulate why until he read Mertz.)
After all, most mathematicians probably like "cute" syntax, even if it's funky and ambiguous. (Sigma notation for sums is silly but looks impressive on paper.)
What never works is what Harold Bloom of Yale does, and argue for difficult liter'cher because it's Good for You. A lot of great literature tries to entertain and appeal to baser desires as well as the highbrows, because the chemical effect stimulates the mind. There are some senses I want programming texts to leave untouched, but showing people uncommon language features can make them feel powerful when done right.
|
|
Tayssir John Gabbour - Re: Metaclass programming in Python, Part 2
9/10/2003; 9:17:03 PM (reads: 738, responses: 0)
|
|
But I guess you profs know about this.
|
|
Frank Atanassow - Re: Metaclass programming in Python, Part 2
9/11/2003; 4:22:55 AM (reads: 690, responses: 1)
|
|
|
Bryn Keller - Re: Metaclass programming in Python, Part 2
9/11/2003; 8:34:04 AM (reads: 655, responses: 0)
|
|
As soon as I learned that Haskell wasn't ever going to catch on because it lacked looping constructs, I knew I had to help. Whew, that was a close one. :-)
|
|
Isaac Gouy - Re: Metaclass programming in Python, Part 2
9/11/2003; 9:35:13 AM (reads: 638, responses: 0)
|
|
|
David Mertz - Re: Metaclass programming in Python, Part 2
9/11/2003; 11:05:06 PM (reads: 545, responses: 0)
|
|
Since several people have written some nice things about me--and specifically about my Text Processing in Python book that came out a few months ago, I figure this is a chance to encourage LtU readers to take a look at it. Clearly I have an ulterior motive of wanting to sell copies.
The thing is that even though such was not really my intent, everyone who comments on the book makes a big point of the occassional use of FP idioms. It really isn't primarily an FP book, and I reckon the parts that are will seem obvious to LtU readers. But perhaps as a way to proselytize, my book would be good for your friends and students :-).
Anyway, if you want to buy it, please do so via This Amazon link <http://tinyurl.com/jskh>. You know, associates kickback and all (I could use a few more dollars). Of course, you can also still read it for free, as you've always been able to. And reviews anywhere are more than welcome.
|
|
Ehud Lamm - Re: Metaclass programming in Python, Part 2
9/16/2003; 5:09:06 AM (reads: 403, responses: 0)
|
|
Well, some people apparently don't like metaclasses...
|
|
|
|