On Wed, Jan 2, 2013 at 10:17 AM, alex23
On Jan 2, 8:16 am, Chris Angelico
wrote: It's a little odd what you can and can't do, until you understand the underlying system fairly well. It's something that's highly unlikely to change; one of the premises would have to be sacrificed (or at least modified) to achieve it.
By this definition, though, every feature of Python that someone doesn't understand is a wart. For a new user, mutable default parameters is a wart, but once you understand Python's execution & object models, it's just the way the language is.
Generally, I find "wart" means "something the user doesn't like about the language even if it makes internal sense".
That's pretty much it, yeah. The warts of Python are the gotchas that need to be grokked before you can call yourself fluent in the language. Might feel as though the designers "got it wrong", or were making an arbitrary choice, but whatever it is, the language behaves that way and you have to get to know it. I agree that mutable defaults as a wart. PHP's scoping rules are simpler than Python's. A variable inside a function is local unless it's explicitly declared global; function names are global. (That's not the whole set of rules, but close enough for this argument.) Python, on the other hand, adds the oddity that a name referenced inside a function is global unless, somewhere in that function, it's assigned to. This is a Python wart that bites people (see the first question in http://toykeeper.net/warts/python/ for instance), but it's a consequence of putting "variables" and "functions" into a single namespace called "name bindings", plus the decision to not require variable declarations (C, for instance, has the same notion of "everything's a name", but instead of declaring globals, declares locals). Python's scoping rules are vastly superior to PHP's, but a bit more complicated, and may need a bit of explanation. (Incidentally, of all the warts listed in the page I linked above, two give a quick and easy error message, two have better ways of doing things (don't use +=, use append/extend), and only one is really a wart - mutable default values. Well, that and the behaviour of += on something in a tuple, but .extend dodges that one too.) Documenting these sorts of oddities is a good thing, as long as the underlying goal is one of new programmer education and not "hey you idiots who develop this language, here's all the things you did wrong". ChrisA